diff -urNad cups-1.2~/cups/http-addr.c cups-1.2/cups/http-addr.c --- cups-1.2~/cups/http-addr.c 2006-03-08 19:34:07.000000000 +0100 +++ cups-1.2/cups/http-addr.c 2006-04-13 13:07:32.000000000 +0200 @@ -510,7 +510,7 @@ if (http) { - if (http->hostname[0] == '/') + if (!http->hostname || http->hostname[0] == '/') strlcpy(s, "localhost", slen); else strlcpy(s, http->hostname, slen); @@ -521,9 +521,16 @@ * Get the hostname... */ - gethostname(s, slen); + if (gethostname(s, slen) != 0) + { + /* + * Fall back to localhost on failure + */ + strlcpy(s, "localhost", slen); + return (s); + } if (!strchr(s, '.')) {