--- src/usr.bin/xinstall/xinstall.c.orig	2009-06-14 19:36:15.000000000 +0300
+++ src/usr.bin/xinstall/xinstall.c	2009-06-14 19:34:18.000000000 +0300
@@ -418,8 +418,7 @@
 	int ret;
 
 	if (dorename) {
-		(void)snprintf(tmpl, sizeof(tmpl), "%s/inst.XXXXXX",
-		    xdirname(to_name));
+		(void)snprintf(tmpl, sizeof(tmpl), "%s.inst.XXXXXX", to_name);
 		/* This usage is safe. */
 		if (mktemp(tmpl) == NULL)
 			err(1, "%s: mktemp", tmpl);
@@ -448,8 +447,7 @@
 	char tmpl[MAXPATHLEN];
 
 	if (dorename) {
-		(void)snprintf(tmpl, sizeof(tmpl), "%s/inst.XXXXXX",
-		    xdirname(to_name));
+		(void)snprintf(tmpl, sizeof(tmpl), "%s.inst.XXXXXX", to_name);
 		/* This usage is safe. */
 		if (mktemp(tmpl) == NULL)
 			err(1, "%s: mktemp", tmpl);
@@ -668,8 +666,7 @@
 		(void)chflags(to_name, to_sb.st_flags & ~(NOCHANGEBITS));
 #endif
 	if (dorename) {
-		(void)snprintf(tmpl, sizeof(tmpl), "%s/inst.XXXXXX",
-		    xdirname(to_name));
+		(void)snprintf(tmpl, sizeof(tmpl), "%s.inst.XXXXXX", to_name);
 		oto_name = to_name;
 		to_name = tmpl;
 	} else {
