aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2011-01-15 08:37:33 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2011-01-15 08:37:33 +0000
commitabdb8aea59b73048cc6d5431c5a3537c757c2f47 (patch)
tree568cf3a13da8ea24fec9f30414b06601864c1389 /lib
parent224d124d19d729c6a5b061c7b4408dbe5be5fbbd (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/realpath.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c
index e75ee4ac823a..66bb8da98608 100644
--- a/lib/libc/stdlib/realpath.c
+++ b/lib/libc/stdlib/realpath.c
@@ -54,7 +54,7 @@ realpath(const char * __restrict path, char * __restrict resolved)
char *p, *q, *s;
size_t left_len, resolved_len;
unsigned symlinks;
- int serrno, slen, m;
+ int m, serrno, slen;
char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
if (path == NULL) {
@@ -73,7 +73,6 @@ realpath(const char * __restrict path, char * __restrict resolved)
m = 1;
} else
m = 0;
-
symlinks = 0;
if (path[0] == '/') {
resolved[0] = '/';
@@ -86,8 +85,10 @@ realpath(const char * __restrict path, char * __restrict resolved)
if (getcwd(resolved, PATH_MAX) == NULL) {
if (m)
free(resolved);
- else
- strlcpy(resolved, ".", PATH_MAX);
+ else {
+ resolved[0] = '.';
+ resolved[1] = '\0';
+ }
return (NULL);
}
resolved_len = strlen(resolved);