Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Jan 2011 11:04:30 +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: r217144 - head/lib/libc/stdlib
Message-ID:  <201101081104.p08B4UlD089190@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Jan  8 11:04:30 2011
New Revision: 217144
URL: http://svn.freebsd.org/changeset/base/217144

Log:
  Fix some style(9) issues.
  Do not use strlcpy() where simple assignment is enough.
  
  Noted by:	bde (long time ago)
  MFC after:	1 week

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

Modified: head/lib/libc/stdlib/realpath.c
==============================================================================
--- head/lib/libc/stdlib/realpath.c	Sat Jan  8 10:56:58 2011	(r217143)
+++ head/lib/libc/stdlib/realpath.c	Sat Jan  8 11:04:30 2011	(r217144)
@@ -54,7 +54,7 @@ realpath(const char * __restrict path, c
 	char *p, *q, *s;
 	size_t left_len, resolved_len;
 	unsigned symlinks;
-	int serrno, slen, m;
+	int m, serrno, slen;
 	char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
 
 	if (path == NULL) {
@@ -73,7 +73,6 @@ realpath(const char * __restrict path, c
 		m = 1;
 	} else
 		m = 0;
-
 	symlinks = 0;
 	if (path[0] == '/') {
 		resolved[0] = '/';
@@ -86,8 +85,10 @@ realpath(const char * __restrict path, c
 		if (getcwd(resolved, PATH_MAX) == NULL) {
 			if (m)
 				free(resolved);
-			else
-				strlcpy(resolved, ".", PATH_MAX);
+			else {
+				resolved[0] = '.';
+				resolved[1] = '\0';
+			}
 			return (NULL);
 		}
 		resolved_len = strlen(resolved);



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