[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.36.2.1 and 1.51

version 1.36.2.1, 2005/08/14 22:08:44 version 1.51, 2012/03/13 21:13:35
Line 50  __RCSID("$NetBSD$");
Line 50  __RCSID("$NetBSD$");
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
   #include <ssp/ssp.h>
   
 #include "extern.h"  #include "extern.h"
   
 #ifdef __weak_alias  #ifdef __weak_alias
 __weak_alias(getcwd,_getcwd)  __weak_alias(getcwd,_getcwd)
   __weak_alias(_sys_getcwd,_getcwd)
 __weak_alias(realpath,_realpath)  __weak_alias(realpath,_realpath)
 #endif  #endif
   
Line 69  char *
Line 71  char *
 realpath(const char *path, char *resolved)  realpath(const char *path, char *resolved)
 {  {
         struct stat sb;          struct stat sb;
         int idx = 0, n, nlnk = 0;          int idx = 0, nlnk = 0;
         const char *q;          const char *q;
         char *p, wbuf[2][MAXPATHLEN];          char *p, wbuf[2][MAXPATHLEN];
         size_t len;          size_t len;
           ssize_t n;
   
         _DIAGASSERT(path != NULL);  
         _DIAGASSERT(resolved != NULL);          _DIAGASSERT(resolved != NULL);
   
           /* POSIX sez we must test for this */
           if (path == NULL) {
                   errno = EINVAL;
                   return NULL;
           }
   
         /*          /*
          * Build real path one by one with paying an attention to .,           * Build real path one by one with paying an attention to .,
          * .. and symbolic link.           * .. and symbolic link.
Line 96  realpath(const char *path, char *resolve
Line 104  realpath(const char *path, char *resolve
   
         /* If relative path, start from current working directory. */          /* If relative path, start from current working directory. */
         if (*path != '/') {          if (*path != '/') {
                 if (getcwd(resolved, MAXPATHLEN) == NULL) {                  /* check for resolved pointer to appease coverity */
                   if (resolved && getcwd(resolved, MAXPATHLEN) == NULL) {
                         p[0] = '.';                          p[0] = '.';
                         p[1] = 0;                          p[1] = 0;
                         return (NULL);                          return (NULL);
Line 200  loop:
Line 209  loop:
 }  }
   
 char *  char *
 getcwd(char *pt, size_t size)  __ssp_real(getcwd)(char *pt, size_t size)
 {  {
         char *npt;          char *npt;
   

Legend:
Removed from v.1.36.2.1  
changed lines
  Added in v.1.51

CVSweb <webmaster@jp.NetBSD.org>