From: Eric Wong <e@80x24.org>
To: mwrap-perl@80x24.org
Subject: [PATCH 3/5] use `%m' for *printf rather than strerror(errno)
Date: Mon, 12 Dec 2022 11:40:54 +0000 [thread overview]
Message-ID: <20221212114056.9615-4-e@80x24.org> (raw)
In-Reply-To: <20221212114056.9615-1-e@80x24.org>
FreeBSD, glibc both support it, as do minimalist libcs such as
uClibc and musl.
---
mwrap_core.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/mwrap_core.h b/mwrap_core.h
index 6d498c1..179f136 100644
--- a/mwrap_core.h
+++ b/mwrap_core.h
@@ -826,8 +826,7 @@ static void dump_destructor(void)
dump_fd = open(dump_path, O_CLOEXEC|O_WRONLY|O_APPEND|O_CREAT,
0666);
if (dump_fd < 0) {
- fprintf(stderr, "open %s failed: %s\n", dump_path,
- strerror(errno));
+ fprintf(stderr, "open %s failed: %m\n", dump_path);
goto out;
}
}
@@ -850,8 +849,7 @@ static void dump_destructor(void)
a.fp = fdopen(dump_fd, modes[i]);
if (!a.fp) {
- fprintf(stderr, "failed to open fd=%d: %s\n",
- dump_fd, strerror(errno));
+ fprintf(stderr, "failed to open fd=%d: %m\n", dump_fd);
goto out;
}
/* we'll leak some memory here, but this is a destructor */
@@ -948,7 +946,7 @@ __attribute__((constructor)) static void mwrap_ctor(void)
h->real = h;
call_rcu(&h->as.dead, free_hdr_rcu);
} else
- fprintf(stderr, "malloc failed: %s\n", strerror(errno));
+ fprintf(stderr, "malloc: %m\n");
h1d_start();
CHECK(int, 0, pthread_sigmask(SIG_SETMASK, &old, NULL));
next prev parent reply other threads:[~2022-12-12 11:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 11:40 [PATCH 0/5] a few odds and ends before full backtrace support Eric Wong
2022-12-12 11:40 ` [PATCH 1/5] httpd: hoist out err_close from ferror|fclose Eric Wong
2022-12-12 11:40 ` [PATCH 2/5] httpd: consolidate open_memstream error checking Eric Wong
2022-12-12 11:40 ` Eric Wong [this message]
2022-12-12 11:40 ` [PATCH 4/5] httpd: mw_h1req comment fixes Eric Wong
2022-12-12 11:40 ` [PATCH 5/5] mwrap_httpd: report ftello error Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221212114056.9615-4-e@80x24.org \
--to=e@80x24.org \
--cc=mwrap-perl@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mwrap-perl.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).