diff options
author | kib <kib@FreeBSD.org> | 2017-05-29 13:00:39 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2017-05-29 13:00:39 +0000 |
commit | 8cffbb101f23735f79c4a426e33a0872dfbebb16 (patch) | |
tree | 5d58552bb4c3fa8f741bd6b94b45a6c35c4a9eca /lib/libc/stdlib/realpath.c | |
parent | ef7c8dc617e695fc33095b8aed872956ed4468e1 (diff) | |
download | FreeBSD-src-8cffbb101f23735f79c4a426e33a0872dfbebb16.zip FreeBSD-src-8cffbb101f23735f79c4a426e33a0872dfbebb16.tar.gz |
MFC r318303:
Style.
Diffstat (limited to 'lib/libc/stdlib/realpath.c')
-rw-r--r-- | lib/libc/stdlib/realpath.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c index 5ee88aa..d19f641 100644 --- a/lib/libc/stdlib/realpath.c +++ b/lib/libc/stdlib/realpath.c @@ -89,7 +89,7 @@ realpath1(const char *path, char *resolved) */ p = strchr(left, '/'); - next_token_len = p ? p - left : left_len; + next_token_len = p != NULL ? p - left : left_len; memcpy(next_token, left, next_token_len); next_token[next_token_len] = '\0'; @@ -112,10 +112,9 @@ realpath1(const char *path, char *resolved) if (next_token[0] == '\0') { /* Handle consequential slashes. */ continue; - } - else if (strcmp(next_token, ".") == 0) + } else if (strcmp(next_token, ".") == 0) { continue; - else if (strcmp(next_token, "..") == 0) { + } else if (strcmp(next_token, "..") == 0) { /* * Strip the last path component except when we have * single "/" @@ -146,13 +145,12 @@ realpath1(const char *path, char *resolved) } slen = readlink(resolved, symlink, sizeof(symlink)); if (slen <= 0 || slen >= sizeof(symlink)) { - if (slen < 0) { - /* keep errno from readlink(2) call */ - } else if (slen == 0) { + if (slen < 0) + ; /* keep errno from readlink(2) call */ + else if (slen == 0) errno = ENOENT; - } else { + else errno = ENAMETOOLONG; - } return (NULL); } symlink[slen] = '\0'; |