If either the path or the resolved path is NULL, realpath() now returns

EINVAL. This also fixes bug #1659.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23087 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-12-08 21:45:40 +00:00
parent 9abdc42489
commit 5f23ba4ac9
1 changed files with 5 additions and 0 deletions

View File

@ -58,6 +58,11 @@ realpath(const char *path, char *resolved)
char *p, *q, wbuf[MAXPATHLEN]; char *p, *q, wbuf[MAXPATHLEN];
int symlinks = 0; int symlinks = 0;
if (path == NULL || resolved == NULL) {
errno = EINVAL;
return NULL;
}
/* Save the starting point. */ /* Save the starting point. */
if ((fd = open(".", O_RDONLY)) < 0) { if ((fd = open(".", O_RDONLY)) < 0) {
strcpy(resolved, "."); strcpy(resolved, ".");