All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: fix removing preshared keys on some platforms
@ 2018-01-27  7:23 Tim Sedlmeyer
  2018-01-27 11:23 ` Jason A. Donenfeld
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Sedlmeyer @ 2018-01-27  7:23 UTC (permalink / raw)
  To: WireGuard mailing list

[-- 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 --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools: fix removing preshared keys on some platforms
  2018-01-27  7:23 [PATCH] tools: fix removing preshared keys on some platforms Tim Sedlmeyer
@ 2018-01-27 11:23 ` Jason A. Donenfeld
  0 siblings, 0 replies; 2+ messages in thread
From: Jason A. Donenfeld @ 2018-01-27 11:23 UTC (permalink / raw)
  To: Tim Sedlmeyer; +Cc: WireGuard mailing list

Hi Tim,

Thanks for the patch, much appreciated. Could you resubmit this with
your Signed-off-by line and the body text wrapped?

Thanks,
Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-27 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-27  7:23 [PATCH] tools: fix removing preshared keys on some platforms Tim Sedlmeyer
2018-01-27 11:23 ` Jason A. Donenfeld

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.