[BACK]Return to sftp-server.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/sftp-server.c between version 1.45.2.1 and 1.46

version 1.45.2.1, 2004/08/19 04:13:27 version 1.46, 2004/06/21 17:36:31
Line 819 
Line 819 
                 status = errno_to_portable(errno);                  status = errno_to_portable(errno);
         else if (S_ISREG(sb.st_mode)) {          else if (S_ISREG(sb.st_mode)) {
                 /* Race-free rename of regular files */                  /* Race-free rename of regular files */
                 if (link(oldpath, newpath) == -1) {                  if (link(oldpath, newpath) == -1)
                         if (errno == EOPNOTSUPP) {                          status = errno_to_portable(errno);
                                 struct stat st;                  else if (unlink(oldpath) == -1) {
   
                                 /*  
                                  * fs doesn't support links, so fall back to  
                                  * stat+rename.  This is racy.  
                                  */  
                                 if (stat(newpath, &st) == -1) {  
                                         if (rename(oldpath, newpath) == -1)  
                                                 status =  
                                                     errno_to_portable(errno);  
                                         else  
                                                 status = SSH2_FX_OK;  
                                 }  
                         } else {  
                                 status = errno_to_portable(errno);  
                         }  
                 } else if (unlink(oldpath) == -1) {  
                         status = errno_to_portable(errno);                          status = errno_to_portable(errno);
                         /* clean spare link */                          /* clean spare link */
                         unlink(newpath);                          unlink(newpath);

Legend:
Removed from v.1.45.2.1  
changed lines
  Added in v.1.46