Re: [BUG] daemon.c blows up on OSX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



merlyn@xxxxxxxxxxxxxx (Randal L. Schwartz) writes:

>>>>>> "Randal" == Randal L Schwartz <merlyn@xxxxxxxxxxxxxx> writes:
>
> Randal> running "git version 1.4.4.3.g5485" on my openbsd box, but I can't get
> Randal> there on my OSX box.
>
> According to my headers, "strncasecmp" is defined in <string.h>,
> "NI_MAXSERV" is defined in <netdb.h>, and "initgrps" is defined
> in "unistd.h".  So this patch works (just verified on OSX), but I
> don't know what damage it does elsehwere:
>
> diff --git a/daemon.c b/daemon.c
> index b129b83..5ce73ed 100644
> --- a/daemon.c
> +++ b/daemon.c
> @@ -1,3 +1,7 @@
> +#include <string.h>
> +#include <netdb.h>
> +#include <unistd.h>
> +
>  #include "cache.h"

This unfortunately violates the "all common system headers in
git-compat-util.h" rule, which is needed to define _XOPEN_SOURCE
and friends before including the system header files.

And string.h, netdb.h and unistd.h are already included there,
so there is something deeper going on on OSX.

Is the declaration of strncasecmp in <string.h> on OSX
conditional to some macro (and the same question about other
symbols you did not get)?  We need to find out what feature
macros are expected on that platform and define them as needed.

For example, on OpenBSD, <sys/types.h> does not expose u_int
without __BSD_VISIBLE, and its <netinet/tcp.h> header uses that
type.  The source files (user programs, that's us) are expected
to include sys/types.h before including netinet/tcp.h *AND*
expected to somehow cause __BSD_VISIBLE be defined before
including sys/types.h.  That's why we have _BSD_SOURCE in our
git-compat-util.h header file (_XOPEN_SOURCE and _GNU_SOURCE
serve similar purposes for various other systems).

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]