git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* daemon.c fails to build on Darwin
@ 2006-09-28 15:48 Randal L. Schwartz
  2006-09-28 16:01 ` Alex Riesen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Randal L. Schwartz @ 2006-09-28 15:48 UTC (permalink / raw)
  To: git


If this is obvious, can someone fix it?  If not, I'll try to sort it out later
tonight.

    gcc -o daemon.o -c -g -O2 -Wall -I/sw/include -I/opt/local/include -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRLCPY daemon.c
    daemon.c: In function 'fill_in_extra_table_entries':
    daemon.c:460: error: 'HOST_NAME_MAX' undeclared (first use in this function)
    daemon.c:460: error: (Each undeclared identifier is reported only once
    daemon.c:460: error: for each function it appears in.)
    daemon.c:460: warning: unused variable 'addrbuf'
    make: *** [daemon.o] Error 1

This is with 2d5b459107cf07bbb307cfb196c2007c497a6dd2.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: daemon.c fails to build on Darwin
  2006-09-28 15:48 daemon.c fails to build on Darwin Randal L. Schwartz
@ 2006-09-28 16:01 ` Alex Riesen
  2006-09-28 16:06 ` Shawn Pearce
  2006-09-28 16:15 ` Junio C Hamano
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Riesen @ 2006-09-28 16:01 UTC (permalink / raw)
  To: Randal L. Schwartz; +Cc: git, Junio C Hamano

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]

On 28 Sep 2006 08:48:36 -0700, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>
> If this is obvious, can someone fix it?  If not, I'll try to sort it out later
> tonight.
>

I used the patch attached.

BTW, could we please _use_ the const keyword?

[-- Attachment #2: fix-daemon-no-ipv6.patch --]
[-- Type: text/x-diff, Size: 1567 bytes --]

diff --git a/daemon.c b/daemon.c
index 5335d21..8b54c63 100644
--- a/daemon.c
+++ b/daemon.c
@@ -830,7 +830,7 @@ #endif
 
 #else /* NO_IPV6 */
 
-static int socksetup(char *lisen_addr, int listen_port, int **socklist_p)
+static int socksetup(char *listen_addr, int listen_port, int **socklist_p)
 {
 	struct sockaddr_in sin;
 	int sockfd;
diff --git a/git-compat-util.h b/git-compat-util.h
index 7ed18e1..a5429d1 100755
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -33,6 +33,10 @@ #ifndef PATH_MAX
 #define PATH_MAX 4096
 #endif
 
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 256
+#endif
+
 #ifdef __GNUC__
 #define NORETURN __attribute__((__noreturn__))
 #else
diff --git a/interpolate.c b/interpolate.c
index 62701d8..5d9d188 100644
--- a/interpolate.c
+++ b/interpolate.c
@@ -8,10 +8,10 @@ #include "git-compat-util.h"
 #include "interpolate.h"
 
 
-void interp_set_entry(struct interp *table, int slot, char *value)
+void interp_set_entry(struct interp *table, int slot, const char *value)
 {
 	char *oldval = table[slot].value;
-	char *newval = value;
+	char *newval = NULL;
 
 	if (oldval)
 		free(oldval);
diff --git a/interpolate.h b/interpolate.h
index a55fb8e..190a180 100644
--- a/interpolate.h
+++ b/interpolate.h
@@ -16,7 +16,7 @@ struct interp {
 	char *value;
 };
 
-extern void interp_set_entry(struct interp *table, int slot, char *value);
+extern void interp_set_entry(struct interp *table, int slot, const char *value);
 extern void interp_clear_table(struct interp *table, int ninterps);
 
 extern int interpolate(char *result, int reslen,

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: daemon.c fails to build on Darwin
  2006-09-28 15:48 daemon.c fails to build on Darwin Randal L. Schwartz
  2006-09-28 16:01 ` Alex Riesen
@ 2006-09-28 16:06 ` Shawn Pearce
  2006-09-28 16:15 ` Junio C Hamano
  2 siblings, 0 replies; 4+ messages in thread
From: Shawn Pearce @ 2006-09-28 16:06 UTC (permalink / raw)
  To: Randal L. Schwartz; +Cc: git

"Randal L. Schwartz" <merlyn@stonehenge.com> wrote:
> 
> If this is obvious, can someone fix it?  If not, I'll try to sort it out later
> tonight.
> 
>     gcc -o daemon.o -c -g -O2 -Wall -I/sw/include -I/opt/local/include -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRLCPY daemon.c
>     daemon.c: In function 'fill_in_extra_table_entries':
>     daemon.c:460: error: 'HOST_NAME_MAX' undeclared (first use in this function)
>     daemon.c:460: error: (Each undeclared identifier is reported only once
>     daemon.c:460: error: for each function it appears in.)
>     daemon.c:460: warning: unused variable 'addrbuf'
>     make: *** [daemon.o] Error 1
> 
> This is with 2d5b459107cf07bbb307cfb196c2007c497a6dd2.

According to pickaxe it was dd4676299dde0a4c6f8a471e6353170f86a78c8a.

Looks like HOST_NAME_MAX isn't defined on Darwin.  Looking at how
daemon.c is using it this just needs to be defined to a suitable
length if its not already defined.  Sort of like PATH_MAX on some
other systems...

-- 
Shawn.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: daemon.c fails to build on Darwin
  2006-09-28 15:48 daemon.c fails to build on Darwin Randal L. Schwartz
  2006-09-28 16:01 ` Alex Riesen
  2006-09-28 16:06 ` Shawn Pearce
@ 2006-09-28 16:15 ` Junio C Hamano
  2 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2006-09-28 16:15 UTC (permalink / raw)
  To: Randal L. Schwartz; +Cc: git

merlyn@stonehenge.com (Randal L. Schwartz) writes:

> If this is obvious, can someone fix it?  If not, I'll try to sort it out later
> tonight.
>
>     gcc -o daemon.o -c -g -O2 -Wall -I/sw/include -I/opt/local/include -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRLCPY daemon.c
>     daemon.c: In function 'fill_in_extra_table_entries':
>     daemon.c:460: error: 'HOST_NAME_MAX' undeclared (first use in this function)
>     daemon.c:460: error: (Each undeclared identifier is reported only once
>     daemon.c:460: error: for each function it appears in.)
>     daemon.c:460: warning: unused variable 'addrbuf'
>     make: *** [daemon.o] Error 1
>
> This is with 2d5b459107cf07bbb307cfb196c2007c497a6dd2.

Sorry about that.  Johannes sent a fix which I'll apply.

From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: [PATCH/RFC] daemon: default to 256 for HOST_NAME_MAX if it is not defined
Date: Thu, 28 Sep 2006 12:00:35 +0200 (CEST)
Message-ID: <Pine.LNX.4.63.0609281200200.14200@wbgn013.biozentrum.uni-wuerzburg.de>

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
	... or should we make it wider available, by putting it into
	cache.h?

 daemon.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/daemon.c b/daemon.c
index 5335d21..fc3951c 100644
--- a/daemon.c
+++ b/daemon.c
@@ -15,6 +15,10 @@ #include "cache.h"
 #include "exec_cmd.h"
 #include "interpolate.h"
 
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 256
+#endif
+
 static int log_syslog;
 static int verbose;
 static int reuseaddr;
-- 
1.4.2.1.g430572-dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-09-28 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-28 15:48 daemon.c fails to build on Darwin Randal L. Schwartz
2006-09-28 16:01 ` Alex Riesen
2006-09-28 16:06 ` Shawn Pearce
2006-09-28 16:15 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).