Hello all,

I am posting here the changes proposed by Avinash Joshi for 6613845.

Thanks,

Antonello

Bug link at bugs.opensolaris.org:
http://bugs.opensolaris.org/view_bug.do?bug_id=6613845

Webrev link (SWAN only):
file:///net/coupe.sfbay/builds/acruz/onnv/webrev/index.html

Webrev link on cr.opensolaris.org:
http://cr.opensolaris.org/~acruz/6613845/webrev/


Plain text diff -u and onnv.patch attachment as well

------- fork.c -------
--- /tmp/geta893929     Tue Nov 13 14:06:20 2007
+++ /tmp/getb893929     Tue Nov 13 14:06:20 2007
@@ -245,8 +245,9 @@
                  * Can't call closefrom() in this MT section
                  * so safely close a minimum set of fds.
                  */
-               for (i = 0; i < 3; i++)
-                       (void) close(i);
+               (void) close(STDIN_FILENO);
+               (void) close(STDOUT_FILENO);
+               (void) close(STDERR_FILENO);
         }

         (void) setpgrp();
@@ -265,7 +266,7 @@
                         while (dup2(fd_console, STDERR_FILENO) < 0 &&
                             errno == EINTR)
                                 ;
-               if (fd_console > 2)
+               if (fd_console > STDERR_FILENO)
                         (void) close(fd_console);
         }

------- log.c -------
--- /tmp/geta889910     Tue Nov 13 14:05:56 2007
+++ /tmp/getb889910     Tue Nov 13 14:05:56 2007
@@ -263,10 +263,10 @@
         if (fd == -1)
                 return;

-       (void) dup2(fd, 1);
-       (void) dup2(fd, 2);
+       (void) dup2(fd, STDOUT_FILENO);
+       (void) dup2(fd, STDERR_FILENO);

-       if (fd != 1 && fd != 2)
+       if (fd != STDOUT_FILENO && fd != STDERR_FILENO)
                 startd_close(fd);
  }

------- startd.c -------
--- /tmp/geta885263     Tue Nov 13 14:05:25 2007
+++ /tmp/getb885263     Tue Nov 13 14:05:25 2007
@@ -814,13 +814,13 @@

         if ((fd = open("/dev/null", O_RDONLY)) == -1) {
                 uu_warn(gettext("can't connect stdin to /dev/null"));
-       } else if (fd != 0) {
-               (void) dup2(fd, 0);
+       } else if (fd != STDIN_FILENO) {
+               (void) dup2(fd, STDIN_FILENO);
                 startd_close(fd);
         }

         closefrom(3);
-       (void) dup2(2, 1);
+       (void) dup2(STDERR_FILENO, STDOUT_FILENO);

         (void) setsid();
         (void) chdir("/");

-------------- next part --------------
A non-text attachment was scrubbed...
Name: onnv.patch
Type: text/x-patch
Size: 2141 bytes
Desc: not available
URL: 
<http://mail.opensolaris.org/pipermail/smf-discuss/attachments/20071113/4f58b1c0/attachment.bin>

Reply via email to