ref: 56c7fa432b66fb12a060c306f1dd3b81c9be7f97
parent: 35718e882070735fcad8390cc40856ef0d42d0cf
author: cinap_lenrek <[email protected]>
date: Tue Jan 3 14:26:23 EST 2023
aux/listen1: write status to standard error
--- a/sys/src/cmd/aux/listen1.c
+++ b/sys/src/cmd/aux/listen1.c
@@ -105,7 +105,7 @@
if(!trusted)
becomenone();
- print("listen started\n");
+ fprint(2, "listen started\n");
ctl = announce(argv[0], dir);
if(ctl < 0)
sysfatal("announce %s: %r", argv[0]);
@@ -166,7 +166,7 @@
exits("accept");
}
- print("incoming call for %s from %s in %s\n", argv[0], remoteaddr(ndir), ndir);
+ fprint(2, "incoming call for %s from %s in %s\n", argv[0], remoteaddr(ndir), ndir);
for(i = 0; i < ncopts; i++)
write(nctl, copts[i], strlen(copts[i]));
@@ -181,7 +181,7 @@
dup(fd, 0);
dup(fd, 1);
/* dup(fd, 2); keep stderr */
- close(fd);
+ if(fd > 2) close(fd);
exec(argv[1], argv+1);
if(argv[1][0] != '/')
exec(smprint("/bin/%s", argv[1]), argv+1);