From 8cffbb101f23735f79c4a426e33a0872dfbebb16 Mon Sep 17 00:00:00 2001 From: kib Date: Mon, 29 May 2017 13:00:39 +0000 Subject: MFC r318303: Style. --- lib/libc/stdlib/realpath.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'lib/libc/stdlib/realpath.c') 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'; -- cgit v1.1