From: Junio C Hamano Date: Mon, 11 May 2015 21:23:53 +0000 (-0700) Subject: Merge branch 'jc/daemon-no-ipv6-for-2.4.1' X-Git-Tag: v2.5.0-rc0~127 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9e4d2f6d45ef46e5774bbf752786ca3b9a4142a5?ds=inline;hp=-c Merge branch 'jc/daemon-no-ipv6-for-2.4.1' "git daemon" fails to build from the source under NO_IPV6 configuration (regression in 2.4). * jc/daemon-no-ipv6-for-2.4.1: daemon: unbreak NO_IPV6 build regression --- 9e4d2f6d45ef46e5774bbf752786ca3b9a4142a5 diff --combined daemon.c index ac2bc852d1,4be10914e6..d3d3e433e3 --- a/daemon.c +++ b/daemon.c @@@ -633,7 -633,7 +633,7 @@@ static void lookup_hostname(struct host char **ap; static char addrbuf[HOST_NAME_MAX + 1]; - hent = gethostbyname(hostname.buf); + hent = gethostbyname(hi->hostname.buf); if (hent) { ap = hent->h_addr_list; memset(&sa, 0, sizeof sa); @@@ -1166,6 -1166,15 +1166,6 @@@ static struct credentials *prepare_cred } #endif -static void store_pid(const char *path) -{ - FILE *f = fopen(path, "w"); - if (!f) - die_errno("cannot open pid file '%s'", path); - if (fprintf(f, "%"PRIuMAX"\n", (uintmax_t) getpid()) < 0 || fclose(f) != 0) - die_errno("failed to write pid file '%s'", path); -} - static int serve(struct string_list *listen_addr, int listen_port, struct credentials *cred) { @@@ -1376,7 -1385,7 +1376,7 @@@ int main(int argc, char **argv sanitize_stdfds(); if (pid_file) - store_pid(pid_file); + write_file(pid_file, 1, "%"PRIuMAX"\n", (uintmax_t) getpid()); /* prepare argv for serving-processes */ cld_argv = xmalloc(sizeof (char *) * (argc + 2));