From b3eca60b5c2246ae25c886c5df44b3176fa90239 Mon Sep 17 00:00:00 2001 From: test2 Date: Tue, 9 Mar 2010 12:27:31 -0800 Subject: [PATCH] Added the definition of SET_BINMODE under WIN32. --- sf-pcap.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sf-pcap.c b/sf-pcap.c index 6903160..9d55dae 100644 --- a/sf-pcap.c +++ b/sf-pcap.c @@ -67,6 +67,19 @@ static const char rcsid[] _U_ = #include "sf-pcap.h" +/* + * Setting O_BINARY on DOS/Windows is a bit tricky + */ +#if defined(WIN32) + #define SET_BINMODE(f) _setmode(_fileno(f), _O_BINARY) +#elif defined(MSDOS) + #if defined(__HIGHC__) + #define SET_BINMODE(f) setmode(f, O_BINARY) + #else + #define SET_BINMODE(f) setmode(fileno(f), O_BINARY) + #endif +#endif + /* * Standard libpcap format. */