Re: daemon.c fails to build on Darwin
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?
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,