Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Jan 2011 08:37:34 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r217441 - stable/8/lib/libc/stdlib
Message-ID:  <201101150837.p0F8bYqN018420@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Jan 15 08:37:33 2011
New Revision: 217441
URL: http://svn.freebsd.org/changeset/base/217441

Log:
  MFC r217144:
  Fix some style(9) issues.
  Do not use strlcpy() where simple assignment is enough.

Modified:
  stable/8/lib/libc/stdlib/realpath.c
Directory Properties:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/locale/   (props changed)
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc/sys/   (props changed)

Modified: stable/8/lib/libc/stdlib/realpath.c
==============================================================================
--- stable/8/lib/libc/stdlib/realpath.c	Sat Jan 15 08:35:41 2011	(r217440)
+++ stable/8/lib/libc/stdlib/realpath.c	Sat Jan 15 08:37:33 2011	(r217441)
@@ -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?201101150837.p0F8bYqN018420>