1
0
mirror of https://github.com/PDP-10/klh10.git synced 2026-04-14 15:55:39 +00:00

Avoid using uninitialized 'pname' in 'pfopen()'

This commit is contained in:
H. David Todd (Mac)
2025-12-18 11:29:38 -05:00
parent ee96db1683
commit 22b65518c5

View File

@@ -1705,19 +1705,19 @@ pfopen(char *basename, struct tuntap_context *tt_ctx, struct osnpf *osnpf)
(void) snprintf(pfname, BASENAMESIZE, "%s%d", basename, i++);
fd = open(pfname, O_RDWR, 0);
} while (fd < 0 && errno == EBUSY); /* If device busy, keep looking */
}
if (fd < 0) {
/* Note possible error meanings:
ENOENT - no such filename
ENXIO - not configured in kernel
*/
esfatal(1, "Couldn't find or open packetfilter device, last tried %s",
pfname);
}
if (fd >= 0) {
basenamecpy(osnpf->osnpf_ifnam, pfname, IFNAM_LEN);
} else {
/* Note possible error meanings:
ENOENT - no such filename
ENXIO - not configured in kernel
*/
esfatal(1, "Couldn't find or open packetfilter device, last tried %s",
pfname);
};
};
tt_ctx->my_tap = TRUE;
basenamecpy(osnpf->osnpf_ifnam, pfname, IFNAM_LEN);
return fd; /* Success! */
}