X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fsocket-util.c;h=aa0c7196da9926de38b7388b8e28ead12e12913e;hb=28c5588e8e1a8d091c5d2275232c35f2968a97fa;hp=4c79cd6a66f223285fe3a144b4116300286775b8;hpb=2f51a7ebdaeb1067e3eef873c62f6c22989c9aad;p=sliver-openvswitch.git diff --git a/lib/socket-util.c b/lib/socket-util.c index 4c79cd6a6..aa0c7196d 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -53,9 +53,9 @@ VLOG_DEFINE_THIS_MODULE(socket_util); * Thus, this file compiles all of the code regardless of the target, by * writing "if (LINUX)" instead of "#ifdef __linux__". */ #ifdef __linux__ -#define LINUX 0 -#else #define LINUX 1 +#else +#define LINUX 0 #endif #ifndef O_DIRECTORY @@ -120,14 +120,22 @@ set_dscp(int fd, uint8_t dscp) success = false; val = dscp << 2; if (setsockopt(fd, IPPROTO_IP, IP_TOS, &val, sizeof val)) { +#ifndef _WIN32 if (sock_errno() != ENOPROTOOPT) { +#else + if (sock_errno() != WSAENOPROTOOPT) { +#endif return sock_errno(); } } else { success = true; } if (setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &val, sizeof val)) { +#ifndef _WIN32 if (sock_errno() != ENOPROTOOPT) { +#else + if (sock_errno() != WSAENOPROTOOPT) { +#endif return sock_errno(); } } else { @@ -352,7 +360,7 @@ shorten_name_via_proc(const char *name, char short_name[MAX_UN_LEN + 1], int dirfd; int len; - if (LINUX) { + if (!LINUX) { return ENAMETOOLONG; }