From: Tim Sedlmeyer <tim@sedlmeyer.us>
To: WireGuard mailing list <WireGuard@lists.zx2c4.com>
Subject: [PATCH] tools: fix removing preshared keys on some platforms
Date: Sat, 27 Jan 2018 07:23:12 +0000 [thread overview]
Message-ID: <CAK_h9uFz5fFZH6HZQtCG1+Lph0BY5AALZoSa+Xm_wDu5HQnUzQ@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 993 bytes --]
errno is checked following fread of the preshared key file. fread doesn't
set errno, so it shouldn't be checked. On the EdgeRouter ER-X when wg uses
glibc instead of musl libc this incorrect check causes removal of preshared
keys to fail. This patch removes the check of errno.
---
src/tools/config.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/tools/config.c b/src/tools/config.c
index 5ab6ece..0407b36 100644
--- a/src/tools/config.c
+++ b/src/tools/config.c
@@ -128,10 +128,6 @@ static bool parse_keyfile(uint8_t key[static
WG_KEY_LEN], const char *path)
}
if (fread(dst, WG_KEY_LEN_BASE64 - 1, 1, f) != 1) {
- if (errno) {
- perror("fread");
- goto out;
- }
/* If we're at the end and we didn't read anything, we're
/dev/null or an empty file. */
if (!ferror(f) && feof(f) && !ftell(f)) {
memset(key, 0, WG_KEY_LEN);
--
2.16.1
[-- Attachment #2: Type: text/html, Size: 1393 bytes --]
next reply other threads:[~2018-01-27 7:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-27 7:23 Tim Sedlmeyer [this message]
2018-01-27 11:23 ` Jason A. Donenfeld
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=CAK_h9uFz5fFZH6HZQtCG1+Lph0BY5AALZoSa+Xm_wDu5HQnUzQ@mail.gmail.com \
--to=tim@sedlmeyer.us \
--cc=WireGuard@lists.zx2c4.com \
/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.
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 NNTP newsgroup(s).