Skip to contentSkip to conversation

tools: fix removing preshared keys failing on some platforms

PATCH New Tim Sedlmeyer 1 participant 1 message Jan 27, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: fix removing preshared keys failing on some platforms

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(-)
src/tools/config.c +0 -4
index 5ab6ece..0407b36 100644
@@ -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);
Signature · 1 line
2.16.1