#! /bin/sh /usr/share/dpatch/dpatch-run ## 71_wall_hostname.dpatch by Petter Reinholdtsen ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Include hostname in output from halt. Closes debian bug ## DP: #325772. @DPATCH@ Index: sysvinit/src/dowall.c =================================================================== --- sysvinit/src/dowall.c (revisjon 100) +++ sysvinit/src/dowall.c (arbeidskopi) @@ -131,6 +131,7 @@ time_t t; char term[UT_LINESIZE+6]; char line[81]; + char hostname[256]; /* HOST_NAME_MAX+1 */ char *date, *p; char *user, *tty; int fd, flags; @@ -144,6 +145,16 @@ getuidtty(&user, &tty); + /* Get and report current hostname, to make it easier to find + out which machine is being shut down. */ + if (0 != gethostname(hostname, sizeof(hostname))) { + strncpy(hostname, "[unknown]", sizeof(hostname)-1); + } + /* If hostname is truncated, it is unspecified if the string + is null terminated or not. Make sure we know it is null + terminated. */ + hostname[sizeof(hostname)-1] = 0; + /* Get the time */ time(&t); date = ctime(&t); @@ -157,8 +168,8 @@ date); } else { snprintf(line, sizeof(line), - "\007\r\nBroadcast message from %s %s(%s):\r\n\r\n", - user, tty, date); + "\007\r\nBroadcast message from %s@%s %s(%s):\r\n\r\n", + user, hostname, tty, date); } /*