[request-sponsor] 6344436 FIXed

2008-01-03 Thread casper....@sun.com

>/solarisws/usr/src/cmd/mv/mv.c
>
>this problem exist for unix domain sockets since 'mknod' cannot be used to 
>create socket files.
>
>fix is, to check whether the file is a unix domain socket or not.
>
>note :value for S_IFSOCK = c000(hex)  'socketfile'
>__
__
>
>bash-3.00# diff -u mv.c.org mv.c
>--- mv.c.orgTue Oct  2 20:15:24 2007
>+++ mv.cSat Dec 29 11:15:49 2007
>@@ -898,11 +898,21 @@
>}
>goto cleanup;
>}
>-   (void) fprintf(stderr,
>-   gettext("%s: %s: unknown file type 0x%x\n"), cmd,
>-   source, (s1.st_mode & S_IFMT));
>-   return (1);
> 
>+   if (( st.st_mode & S_IFMT) == S_IFSOCK) {
>+   (void) fprintf(stderr,
>+   gettext("%s: %s: cannot create unix socket file \n"), 
>cmd, source);


Technically you could create a unix domain socket there (using bind(2))

Casper




[request-sponsor] 6344436 FIXed

2008-01-03 Thread Visakh M R
/solarisws/usr/src/cmd/mv/mv.c

this problem exist for unix domain sockets since 'mknod' cannot be used to 
create socket files.

fix is, to check whether the file is a unix domain socket or not.

note :value for S_IFSOCK = c000(hex)  'socketfile'


bash-3.00# diff -u mv.c.org mv.c
--- mv.c.orgTue Oct  2 20:15:24 2007
+++ mv.cSat Dec 29 11:15:49 2007
@@ -898,11 +898,21 @@
}
goto cleanup;
}
-   (void) fprintf(stderr,
-   gettext("%s: %s: unknown file type 0x%x\n"), cmd,
-   source, (s1.st_mode & S_IFMT));
-   return (1);
 
+   if (( st.st_mode & S_IFMT) == S_IFSOCK) {
+   (void) fprintf(stderr,
+   gettext("%s: %s: cannot create unix socket file \n"), 
cmd, source);
+
+   return (1);
+   }
+   else {
+   (void) fprintf(stderr,
+   gettext("%s: %s: unknown file type 0x%x\n"), cmd,
+   source, (s1.st_mode & S_IFMT));
+
+   return (1);
+   }
+
 cleanup:
if (unlink(source) < 0) {
(void) unlink(target);

---

 is this the required fix?
 
 
This message posted from opensolaris.org