summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-02-23 17:47:47 -0500
committerJune McEnroe <june@causal.agency>2018-02-23 17:47:47 -0500
commitbb7198a777ed79000c71ae539582c097bb253750 (patch)
treed4fa51ee24cc6a4b2f3ee075a4e667bc5d578db4 /bin
parentClean up pbd (diff)
downloadsrc-bb7198a777ed79000c71ae539582c097bb253750.tar.gz
src-bb7198a777ed79000c71ae539582c097bb253750.zip
Avoid unnecessary FDs in errors
Diffstat (limited to 'bin')
-rw-r--r--bin/dtch.c10
-rw-r--r--bin/hnel.c4
2 files changed, 7 insertions, 7 deletions
diff --git a/bin/dtch.c b/bin/dtch.c
index bbdb14e0..bed3537c 100644
--- a/bin/dtch.c
+++ b/bin/dtch.c
@@ -138,7 +138,7 @@ static int dtch(int argc, char *argv[]) {
     if (error) err(EX_IOERR, "%s", addr.sun_path);
 
     error = fcntl(server, F_SETFD, FD_CLOEXEC);
-    if (error) err(EX_IOERR, "fcntl(%d)", server);
+    if (error) err(EX_IOERR, "fcntl");
 
     int pty;
     pid_t pid = forkpty(&pty, NULL, NULL, NULL);
@@ -154,13 +154,13 @@ static int dtch(int argc, char *argv[]) {
 
     for (;;) {
         int client = accept(server, NULL, NULL);
-        if (client < 0) err(EX_IOERR, "accept(%d)", server);
+        if (client < 0) err(EX_IOERR, "accept");
 
         ssize_t size = sendFd(client, pty);
-        if (size < 0) warn("sendmsg(%d)", client);
+        if (size < 0) warn("sendmsg");
 
         size = recv(client, &z, sizeof(z), 0);
-        if (size < 0) warn("recv(%d)", client);
+        if (size < 0) warn("recv");
 
         close(client);
 
@@ -195,7 +195,7 @@ static int atch(int argc, char *argv[]) {
     if (error) err(EX_NOINPUT, "%s", addr.sun_path);
 
     int pty = recvFd(client);
-    if (pty < 0) err(EX_IOERR, "recvmsg(%d)", client);
+    if (pty < 0) err(EX_IOERR, "recvmsg");
 
     struct winsize window;
     error = ioctl(STDERR_FILENO, TIOCGWINSZ, &window);
diff --git a/bin/hnel.c b/bin/hnel.c
index 40ab7bbc..97f3cf0d 100644
--- a/bin/hnel.c
+++ b/bin/hnel.c
@@ -60,7 +60,7 @@ int main(int argc, char *argv[]) {
 
     struct winsize window;
     error = ioctl(STDERR_FILENO, TIOCGWINSZ, &window);
-    if (error) err(EX_IOERR, "ioctl(%d, TIOCGWINSZ, ...)", STDERR_FILENO);
+    if (error) err(EX_IOERR, "TIOCGWINSZ");
 
     int pty;
     pid_t pid = forkpty(&pty, NULL, NULL, &window);
@@ -111,7 +111,7 @@ int main(int argc, char *argv[]) {
 
         int status;
         pid_t dead = waitpid(pid, &status, WNOHANG);
-        if (dead < 0) err(EX_OSERR, "waitpid(%d, ...)", pid);
+        if (dead < 0) err(EX_OSERR, "waitpid(%d)", pid);
         if (dead) return WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE;
     }
     err(EX_IOERR, "poll");