summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2017-05-29 12:55:26 +0000
committerkib <kib@FreeBSD.org>2017-05-29 12:55:26 +0000
commita8b78f2a29971b6fb72716fc181ec1553fd89fb3 (patch)
tree3eac235fb9aa9e201da005018fa1ffc03be2945b
parenteeaa6e089d1520d1eef42171148268fb13dc790c (diff)
downloadFreeBSD-src-a8b78f2a29971b6fb72716fc181ec1553fd89fb3.zip
FreeBSD-src-a8b78f2a29971b6fb72716fc181ec1553fd89fb3.tar.gz
MFC r318303:
Style.
-rw-r--r--lib/libc/stdlib/realpath.c16
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';
OpenPOWER on IntegriCloud