| version 1.30, 2003/08/03 04:14:00 |
version 1.31, 2003/08/03 04:35:50 |
| Line 107 realpath(path, resolved) |
|
| Line 107 realpath(path, resolved) |
|
| * if it is a directory, then change to that directory. |
* if it is a directory, then change to that directory. |
| * get the current directory name and append the basename. |
* get the current directory name and append the basename. |
| */ |
*/ |
| (void)strlcpy(resolved, path, MAXPATHLEN); |
if (strlcpy(resolved, path, MAXPATHLEN) >= MAXPATHLEN) { |
| |
errno = ENAMETOOLONG; |
| |
goto err1; |
| |
} |
| loop: |
loop: |
| q = strrchr(resolved, '/'); |
q = strrchr(resolved, '/'); |
| if (q != NULL) { |
if (q != NULL) { |
|
|
| * Save the last component name and get the full pathname of |
* Save the last component name and get the full pathname of |
| * the current directory. |
* the current directory. |
| */ |
*/ |
| (void)strlcpy(wbuf, p, sizeof(wbuf)); |
if (strlcpy(wbuf, p, sizeof(wbuf)) >= sizeof(wbuf)) { |
| |
errno = ENAMETOOLONG; |
| |
goto err1; |
| |
} |
| |
|
| /* |
/* |
| * Call the inernal internal version of getcwd which |
* Call the inernal internal version of getcwd which |
|
|
| goto err1; |
goto err1; |
| } |
} |
| if (rootd == 0) |
if (rootd == 0) |
| (void)strlcat(resolved, "/", MAXPATHLEN); |
if (strlcat(resolved, "/", MAXPATHLEN) >= MAXPATHLEN) { |
| (void)strlcat(resolved, wbuf, MAXPATHLEN); |
errno = ENAMETOOLONG; |
| |
goto err1; |
| |
} |
| |
if (strlcat(resolved, wbuf, MAXPATHLEN) >= MAXPATHLEN) { |
| |
errno = ENAMETOOLONG; |
| |
goto err1; |
| |
} |
| } |
} |
| |
|
| /* Go back to where we came from. */ |
/* Go back to where we came from. */ |