svn commit: r318303 - head/lib/libc/stdlib

Konstantin Belousov kib at FreeBSD.org
Mon May 15 17:54:37 UTC 2017


Author: kib
Date: Mon May 15 17:54:36 2017
New Revision: 318303
URL: https://svnweb.freebsd.org/changeset/base/318303

Log:
  Style.
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/lib/libc/stdlib/realpath.c

Modified: head/lib/libc/stdlib/realpath.c
==============================================================================
--- head/lib/libc/stdlib/realpath.c	Mon May 15 17:51:01 2017	(r318302)
+++ head/lib/libc/stdlib/realpath.c	Mon May 15 17:54:36 2017	(r318303)
@@ -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-head mailing list