changeset 10294:b85a363540de

6344436 *mv* gives cryptic error when applied to unix domain sockets
author danny webster <dannywebster@googlemail.com>
date Wed, 12 Aug 2009 09:39:20 +0100
parents ac02598ffdd8
children f7a18a1e9610
files usr/src/cmd/mv/mv.c
diffstat 1 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/mv/mv.c	Tue Aug 11 19:17:28 2009 -0700
+++ b/usr/src/cmd/mv/mv.c	Wed Aug 12 09:39:20 2009 +0100
@@ -66,6 +66,7 @@
 #define	ISDEV(A)	((A.st_mode & S_IFMT) == S_IFCHR || \
 			(A.st_mode & S_IFMT) == S_IFBLK || \
 			(A.st_mode & S_IFMT) == S_IFIFO)
+#define	ISSOCK(A)	((A.st_mode & S_IFMT) == S_IFSOCK)
 
 #define	BLKSIZE	4096
 #define	PATHSIZE 1024
@@ -477,7 +478,7 @@
 
 	/*
 	 * Make sure source file is not a directory,
-	 * we can't link directories...
+	 * we cannot link directories...
 	 */
 
 	if (ISDIR(s1)) {
@@ -643,15 +644,24 @@
 			return (n);
 		}
 
-		/* doors can't be moved across filesystems */
+		/* doors cannot be moved across filesystems */
 		if (ISDOOR(s1)) {
 			(void) fprintf(stderr,
-			    gettext("%s: %s: can't move door "
+			    gettext("%s: %s: cannot move door "
 			    "across file systems\n"), cmd, source);
 			return (1);
 		}
+
+		/* sockets cannot be moved across filesystems */
+		if (ISSOCK(s1)) {
+			(void) fprintf(stderr,
+			    gettext("%s: %s: cannot move socket "
+			    "across file systems\n"), cmd, source);
+			return (1);
+		}
+
 		/*
-		 * File can't be renamed, try to recreate the symbolic
+		 * File cannot be renamed, try to recreate the symbolic
 		 * link or special device, or copy the file wholesale
 		 * between file systems.
 		 */
@@ -1212,7 +1222,7 @@
 	if (realpath(path, rpath) == NULL) {
 		int	errno_save = errno;
 		(void) fprintf(stderr, gettext(
-		    "%s: can't resolve path %s: "), cmd, path);
+		    "%s: cannot resolve path %s: "), cmd, path);
 		errno = errno_save;
 		perror("");
 		return (0);