[BACK]Return to file.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/file.c between version 1.92 and 1.93

version 1.92, 2014/03/20 07:47:29 version 1.93, 2014/03/31 21:29:59
Line 225 
Line 225 
          */           */
         if (fisdir(fname) == TRUE) {          if (fisdir(fname) == TRUE) {
                 ro = TRUE;                  ro = TRUE;
         } else if (access(fname, W_OK) == -1) {          } else if ((access(fname, W_OK) == -1) && (errno != ENOENT)) {
                 if (errno != ENOENT)                  ro = TRUE;
           } else if (errno == ENOENT) {
                   (void)xdirname(dp, fname, sizeof(dp));
                   (void)strlcat(dp, "/", sizeof(dp));
   
                   if (stat(dp, &statbuf) == -1 && errno == ENOENT) {
                           /* not read-only; like emacs */
                           ewprintf("Use M-x make-directory RET RET to create the"
                               " directory and its parents");
                   } else if (access(dp, W_OK) == -1 && errno == EACCES) {
                           ewprintf("File not found and directory"
                               " write-protected");
                         ro = TRUE;                          ro = TRUE;
                 else if (errno == ENOENT) {  
                         (void)xdirname(dp, fname, sizeof(dp));  
                         (void)strlcat(dp, "/", sizeof(dp));  
                         if (stat(dp, &statbuf) == -1 && errno == ENOENT) {  
                                 /* no read-only; like emacs */  
                                 ewprintf("Use M-x make-directory RET RET to "  
                                     "create the directory and its parents");  
                         } else if (access(dp, W_OK) == -1 &&  
                             errno == EACCES) {  
                                 ewprintf("File not found and directory"  
                                     " write-protected");  
                                 ro = TRUE;  
                         }  
                 }                  }
         }          }
         if (ro == TRUE)          if (ro == TRUE)

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.93