Date: Wed, 21 Mar 2012 08:00:43 +0400 From: Solar Designer <solar@...nwall.com> To: john-dev@...ts.openwall.com Subject: Re: vncpcap2john.cpp + Mac OS X Erik, Dhiru - On Mon, Mar 19, 2012 at 06:03:47PM -0400, Erik Winkler wrote: > > > > Regarding #define _BSD_SOURCE, you must do it as the very first thing > > (before the very first #include), whereas #define __FAVOR_BSD has a > > tends to work even if specified in-between the #include directives (yet > > is a wrong thing to do and may result in problems). My guess is that > > you tried placing #define _BSD_SOURCE after some #include directive. > > That is where I put it, before any #include statements. I get the structure errors since the BSD structure is different from the standard Linux structure. Only _FAVOR_BSD fixes this issue. I think I figured it out. glibc's features.h does: /* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */ #if defined _BSD_SOURCE && \ !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \ defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \ defined _GNU_SOURCE || defined _SVID_SOURCE) # define __FAVOR_BSD 1 #endif So it ignores _BSD_SOURCE if another _*_SOURCE is defined - and plenty of those are defined by default for C++. The problem should be gone when we move to plain C. Arguably, it is a shortcoming of glibc that there's no valid way to use the BSD structs from C++ programs. Alexander
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.