From 1d0db9488b958ef7d800b9ee9be176496be815d3 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Fri, 23 Feb 2018 17:47:47 -0500 Subject: Avoid unnecessary FDs in errors --- bin/dtch.c | 10 +++++----- bin/hnel.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/dtch.c b/bin/dtch.c index 23407386..6fe85838 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 81879429..0b365e51 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"); -- cgit 1.4.1 > (unfollow)
Commit message (Expand)Author
2020-02-13Only uiShow if hidden and only uiHide if shownJune McEnroe
2020-02-13Rename procPipe to utilPipeJune McEnroe
2020-02-13Set swap correctly when closing a windowJune McEnroe
2020-02-13Refactor windows into array and add /moveJune McEnroe
2020-02-13Clean up manual lintsJune McEnroe
2020-02-13Add -g for generating certificatesJune McEnroe
2020-02-13Explicitly close the TLS connectionJune McEnroe
2020-02-12Add sandman wrapperJune McEnroe
2020-02-12Document scripts in READMEJune McEnroe
2020-02-12Add -N flag for notificationsJune McEnroe
2020-02-12Mark and unmark on uiHide, uiShowJune McEnroe
2020-02-12Hide debug prompt if buffer starts with /June McEnroe
2020-02-12Only exit on errorneous nick during registrationJune McEnroe
2020-02-12Add 378 to list of WHOIS responsesJune McEnroe
2020-02-13Implement source address selectionmultiplexd
2020-02-12Add /listJune McEnroe
2020-02-12Simplify transpose swapJune McEnroe
2020-02-12Add C-t transposeJune McEnroe
2020-02-12Add C-v and M-vJune McEnroe
2020-02-12Allow for arguments to open/copy utilitiesJune McEnroe
2020-02-12Handle RPL_AWAYJune McEnroe
2020-02-11Support monochromatic terminalsJune McEnroe
2020-02-11Add .gz to chroot-man scriptJune McEnroe
2020-02-11Add -R restricted flagJune McEnroe
2020-02-11Add chroot targetJune McEnroe
2020-02-11Exit focus and paste modes on err exitJune McEnroe
2020-02-11Add startup GPLv3 note and URLJune McEnroe
2020-02-11Make sure -D_GNU_SOURCE ends up in CFLAGS on LinuxJune McEnroe
2020-02-11Add note about setting PKG_CONFIG_PATHJune McEnroe
2020-02-11Rename query ID on nick changeJune McEnroe
2020-02-11Call completeClear when closing a windowJune McEnroe
2020-02-11Don't insert color codes for non-mentionsJune McEnroe
2020-02-11Take first two words in colorMentionsJune McEnroe
2020-02-11Use time_t for save signatureJune McEnroe
2020-02-11Set self.nick to * initiallyJune McEnroe
2020-02-11Define ColorCap instead of hardcoding 100June McEnroe
2020-02-11Move hash to top of chat.hJune McEnroe
2020-02-11Move base64 out of chat.hJune McEnroe
2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe
2020-02-11Fix whois idle unit calculationJune McEnroe
2020-02-11Cast towupper to wchar_tJune McEnroe
2020-02-11Cast set but unused variables to voidJune McEnroe
2020-02-11Declare strlcatJune McEnroe
2020-02-11Check if VDSUSP existsJune McEnroe
2020-02-11Fix completeReplace iterationJune McEnroe
2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe
2020-02-11Remove legacy codeJune McEnroe
2020-02-11Add INSTALLING section to READMEJune McEnroe