svn commit: r319128 - stable/11/lib/libc/stdlib

Konstantin Belousov kib at FreeBSD.org
Mon May 29 12:55:28 UTC 2017


Author: kib
Date: Mon May 29 12:55:26 2017
New Revision: 319128
URL: https://svnweb.freebsd.org/changeset/base/319128

Log:
  MFC r318303:
  Style.

Modified:
  stable/11/lib/libc/stdlib/realpath.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/stdlib/realpath.c
==============================================================================
--- stable/11/lib/libc/stdlib/realpath.c	Mon May 29 12:53:44 2017	(r319127)
+++ stable/11/lib/libc/stdlib/realpath.c	Mon May 29 12:55:26 2017	(r319128)
@@ -89,7 +89,7 @@ realpath1(const char *path, char *resolv
 		 */
 		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 *resolv
 		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 *resolv
 			}
 			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';


More information about the svn-src-stable mailing list