X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fsysdep.c;h=c307469bdba9a1a9a2b697c7dfeffd68da71fdbc;hp=b81efbb6d05429cd210d2927286cc51725e437f4;hb=dbf2768f7b146e97e37a27316f70bb313f1acf15;hpb=042cabb13b0419d8aa5cfac9e087d78730d1dbc7 diff --git a/src/sysdep.c b/src/sysdep.c index b81efbb..c307469 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -3158,9 +3158,11 @@ sys_rename (const char *old, const char *new) /* Windows rename fails if NEW exists */ if (rename (old, new) == 0) return 0; - if (errno != EEXIST) + /* In some cases errno is EACCES if NEW exists */ + if (errno != EEXIST && errno != EACCES) + return -1; + if (unlink (new) != 0) return -1; - unlink (new); #endif /* WIN32_NATIVE */ return rename (old, new); }