diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-01-29 11:43:06 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-01-29 11:43:06 -0800 |
commit | 70beb0c3c2bee327a4e02f8c152078633098ba86 (patch) | |
tree | 96e62c736d139728f8790b4c7dbef3c128aa22eb /nametoaddr.c | |
parent | 2fdcb551bde2b8fc0bc0dfda4c16455478788a9b (diff) |
Don't use fopen_s().
It always opens the file with "deny all" sharing on Windows; we don't
want that, because we want UN*X semantics, with "deny none" sharing -
that's what people expect.
We'll squelch the warnings later; fopen() does the same parameter
checking that fopen_s() does, it doesn't return an errno value but it
probably sets errno and errno is probably thread-safe (inferred from
Microsoft's documentation), and we don't *want* the "security" offered
by opening the file "deny all", so the only thing we don't want is the
warnings.
Diffstat (limited to 'nametoaddr.c')
-rw-r--r-- | nametoaddr.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/nametoaddr.c b/nametoaddr.c index eea629a9..c69c36dd 100644 --- a/nametoaddr.c +++ b/nametoaddr.c @@ -133,8 +133,6 @@ #include <string.h> #include <stdio.h> -#include "fopen.h" - #include "pcap-int.h" #include "gencode.h" @@ -717,8 +715,9 @@ pcap_ether_hostton(const char *name) static int init = 0; if (!init) { + fp = fopen(PCAP_ETHERS_FILE, "r"); ++init; - if (pcap_fopen(&fp, PCAP_ETHERS_FILE, "r") != 0) + if (fp == NULL) return (NULL); } else if (fp == NULL) return (NULL); |