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

Diff for /src/usr.bin/make/Attic/util.c between version 1.17 and 1.18

version 1.17, 2002/02/19 19:39:38 version 1.18, 2002/05/29 09:23:25
Line 46 
Line 46 
 {  {
     static char buf[100];      static char buf[100];
     if (e < 0 || e >= sys_nerr) {      if (e < 0 || e >= sys_nerr) {
         sprintf(buf, "Unknown error %d", e);          snprintf(buf, sizeof buf, "Unknown error %d", e);
         return buf;          return buf;
     }      }
     else      else
Line 208 
Line 208 
     /* find the inode of root */      /* find the inode of root */
     if (stat("/", &st_root) == -1) {      if (stat("/", &st_root) == -1) {
         (void)sprintf(pathname,          (void)sprintf(pathname,
                         "getwd: Cannot stat \"/\" (%s)", strerror(errno));              "getwd: Cannot stat \"/\" (%s)", strerror(errno));
         return NULL;          return NULL;
     }      }
     pathbuf[MAXPATHLEN - 1] = '\0';      pathbuf[MAXPATHLEN - 1] = '\0';
Line 219 
Line 219 
     /* find the inode of the current directory */      /* find the inode of the current directory */
     if (lstat(".", &st_cur) == -1) {      if (lstat(".", &st_cur) == -1) {
         (void)sprintf(pathname,          (void)sprintf(pathname,
                         "getwd: Cannot stat \".\" (%s)", strerror(errno));              "getwd: Cannot stat \".\" (%s)", strerror(errno));
         return NULL;          return NULL;
     }      }
     nextpathptr = strrcpy(nextpathptr, "../");      nextpathptr = strrcpy(nextpathptr, "../");
Line 237 
Line 237 
         /* open the parent directory */          /* open the parent directory */
         if (stat(nextpathptr, &st_dotdot) == -1) {          if (stat(nextpathptr, &st_dotdot) == -1) {
             (void)sprintf(pathname,              (void)sprintf(pathname,
                             "getwd: Cannot stat directory \"%s\" (%s)",                  "getwd: Cannot stat directory \"%s\" (%s)",
                             nextpathptr, strerror(errno));                  nextpathptr, strerror(errno));
             return NULL;              return NULL;
         }          }
         if ((dp = opendir(nextpathptr)) == NULL) {          if ((dp = opendir(nextpathptr)) == NULL) {
             (void)sprintf(pathname,              (void)sprintf(pathname,
                             "getwd: Cannot open directory \"%s\" (%s)",                  "getwd: Cannot open directory \"%s\" (%s)",
                             nextpathptr, strerror(errno));                  nextpathptr, strerror(errno));
             return NULL;              return NULL;
         }          }
   
Line 265 
Line 265 
                     continue;                      continue;
                 (void)strcpy(cur_name_add, d->d_name);                  (void)strcpy(cur_name_add, d->d_name);
                 if (lstat(nextpathptr, &st_next) == -1) {                  if (lstat(nextpathptr, &st_next) == -1) {
                     (void)sprintf(pathname, "getwd: Cannot stat \"%s\" (%s)",                      (void)sprintf(pathname,
                                     d->d_name, strerror(errno));                          "getwd: Cannot stat \"%s\" (%s)",
                           d->d_name, strerror(errno));
                     (void)closedir(dp);                      (void)closedir(dp);
                     return NULL;                      return NULL;
                 }                  }
Line 277 
Line 278 
             }              }
         }          }
         if (d == NULL) {          if (d == NULL) {
             (void)sprintf(pathname, "getwd: Cannot find \".\" in \"..\"");              (void)sprintf(pathname,
                   "getwd: Cannot find \".\" in \"..\"");
             (void)closedir(dp);              (void)closedir(dp);
             return NULL;              return NULL;
         }          }

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18