svn commit: r303928 - head/usr.bin/xinstall

Bryan Drewery bdrewery at FreeBSD.org
Wed Aug 10 18:18:53 UTC 2016


Author: bdrewery
Date: Wed Aug 10 18:18:51 2016
New Revision: 303928
URL: https://svnweb.freebsd.org/changeset/base/303928

Log:
  Trim out excessive / with -v when target directory ends with a trailing '/'.
  
  This is a minor nit after r289391 made all installations to a directory always
  end in a trailing '/'.
  
  MFC after:	3 days
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/usr.bin/xinstall/xinstall.c

Modified: head/usr.bin/xinstall/xinstall.c
==============================================================================
--- head/usr.bin/xinstall/xinstall.c	Wed Aug 10 17:19:33 2016	(r303927)
+++ head/usr.bin/xinstall/xinstall.c	Wed Aug 10 18:18:51 2016	(r303928)
@@ -749,8 +749,9 @@ install(const char *from_name, const cha
 		}
 		/* Build the target path. */
 		if (flags & DIRECTORY) {
-			(void)snprintf(pathbuf, sizeof(pathbuf), "%s/%s",
+			(void)snprintf(pathbuf, sizeof(pathbuf), "%s%s%s",
 			    to_name,
+			    to_name[strlen(to_name) - 1] == '/' ? "" : "/",
 			    (p = strrchr(from_name, '/')) ? ++p : from_name);
 			to_name = pathbuf;
 		}


More information about the svn-src-all mailing list