static int sock, port;
static struct hostrec *first_host;
static time_t now, last_local_scan;
+static char hostname[64];
static void die(char *msg, ...) __attribute__((noreturn));
if (connect(sock, (struct sockaddr *) &sa, sizeof(sa)) < 0)
die("Cannot connect socket: %m");
}
+
+ if (gethostname(hostname, sizeof(hostname)) < 0)
+ die("Unable to get my own host name: %m");
}
static void
local_scan(void)
{
struct nwho_pkt pkt;
- static char hostname[64];
make_pkt(&pkt);
- if (!hostname[0] && gethostname(hostname, sizeof(hostname)) < 0)
- die("gethostname: %m");
save_pkt(hostname, &pkt);
}