svn commit: r318069 - stable/11/usr.bin/xinstall

Bryan Drewery bdrewery at FreeBSD.org
Tue May 9 18:13:24 UTC 2017


Author: bdrewery
Date: Tue May  9 18:13:23 2017
New Revision: 318069
URL: https://svnweb.freebsd.org/changeset/base/318069

Log:
  MFC r303928:
  
    Trim out excessive / with -v when target directory ends with a trailing '/'.

Modified:
  stable/11/usr.bin/xinstall/xinstall.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/xinstall/xinstall.c
==============================================================================
--- stable/11/usr.bin/xinstall/xinstall.c	Tue May  9 18:12:05 2017	(r318068)
+++ stable/11/usr.bin/xinstall/xinstall.c	Tue May  9 18:13:23 2017	(r318069)
@@ -755,8 +755,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