a bit more careful about write errors
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 23 Jan 1983 10:59:54 +0000 (02:59 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Sun, 23 Jan 1983 10:59:54 +0000 (02:59 -0800)
SCCS-vsn: lib/libc/net/rcmd.c 4.6

usr/src/lib/libc/net/rcmd.c

index afd3af2..47bc868 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)rcmd.c     4.5 %G%";
+static char sccsid[] = "@(#)rcmd.c     4.6 %G%";
 #endif
 
 #include <stdio.h>
 #endif
 
 #include <stdio.h>
@@ -68,7 +68,11 @@ retry:
                }
                listen(s2, 1);
                (void) sprintf(num, "%d", lport);
                }
                listen(s2, 1);
                (void) sprintf(num, "%d", lport);
-               (void) write(s, num, strlen(num)+1);
+               if (write(s, num, strlen(num)+1) != strlen(num)+1) {
+                       perror("write: setting up stderr");
+                       (void) close(s2);
+                       goto bad;
+               }
                { int len = sizeof (from);
                  s3 = accept(s2, &from, &len, 0);
                  close(s2);
                { int len = sizeof (from);
                  s3 = accept(s2, &from, &len, 0);
                  close(s2);