[BACK]Return to getcwd.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / gen

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libc/gen/getcwd.c between version 1.27 and 1.30

version 1.27, 2002/11/17 01:51:24 version 1.30, 2003/08/03 04:14:00
Line 95  realpath(path, resolved)
Line 95  realpath(path, resolved)
   
         /* Save the starting point. */          /* Save the starting point. */
         if ((fd = open(".", O_RDONLY)) < 0) {          if ((fd = open(".", O_RDONLY)) < 0) {
                 (void)strcpy(resolved, ".");                  (void)strlcpy(resolved, ".", MAXPATHLEN);
                 return (NULL);                  return (NULL);
         }          }
   
Line 169  loop:
Line 169  loop:
                 rootd = 0;                  rootd = 0;
   
         if (*wbuf) {          if (*wbuf) {
                 if (strlen(resolved) + strlen(wbuf) + rootd + 1 > MAXPATHLEN) {                  if (strlen(resolved) + strlen(wbuf) + (rootd ? 0 : 1) + 1 >
                       MAXPATHLEN) {
                         errno = ENAMETOOLONG;                          errno = ENAMETOOLONG;
                         goto err1;                          goto err1;
                 }                  }
                 if (rootd == 0)                  if (rootd == 0)
                         (void)strcat(resolved, "/"); /* XXX: strcat is safe */                          (void)strlcat(resolved, "/", MAXPATHLEN);
                 (void)strcat(resolved, wbuf);   /* XXX: strcat is safe */                  (void)strlcat(resolved, wbuf, MAXPATHLEN);
         }          }
   
         /* Go back to where we came from. */          /* Go back to where we came from. */

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.30

CVSweb <webmaster@jp.NetBSD.org>