Репозитории ALT
5.1: | 2.86-alt2 |
4.1: | 2.86-alt2 |
4.0: | 2.86-alt1 |
3.0: | 2.85-alt8 |
Группа :: Система/Настройка/Загрузка и инициализация
Пакет: SysVinit
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: sysvinit-2.86-deb-wall-hostname.patch
Скачать
Скачать
#! /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);
}
/*