Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 May 2017 17:54:36 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318303 - head/lib/libc/stdlib
Message-ID:  <201705151754.v4FHsaxM045569@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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';



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705151754.v4FHsaxM045569>