xgethostname: handle long hostnames
[gitweb.git] / fetch-pack.c
index a75ed6c940406cfe4befc6dbc61845f6af12cfc1..f43adfe7b55c3883d14449e7e577b7c65fac1320 100644 (file)
@@ -746,7 +746,7 @@ static int get_pack(struct fetch_pack_args *args,
                        argv_array_push(&cmd.args, "--fix-thin");
                if (args->lock_pack || unpack_limit) {
                        char hostname[HOST_NAME_MAX + 1];
-                       if (gethostname(hostname, sizeof(hostname)))
+                       if (xgethostname(hostname, sizeof(hostname)))
                                xsnprintf(hostname, sizeof(hostname), "localhost");
                        argv_array_pushf(&cmd.args,
                                        "--keep=fetch-pack %"PRIuMAX " on %s",