1 --- a/util-linux-2.25.1/term-utils/wall.c 2014-08-26 16:48:45.000000000 +0200
2 +++ b/util-linux-2.25.1/term-utils/wall.c 2016-03-17 15:52:07.000000000 +0100
5 if (print_banner == TRUE) {
6 char *hostname = xgethostname();
7 - char *whom, *where, *date;
8 + char *whom = NULL, *where, *date;
12 - if (!(whom = getlogin()) || !*whom)
13 - whom = (pw = getpwuid(getuid())) ? pw->pw_name : "???";
14 + if((pw = getpwuid(getuid()))!=NULL)
18 warn(_("cannot get passwd uid"));
20 - where = ttyname(STDOUT_FILENO);
21 + where = ttyname(STDIN_FILENO);
22 + if (!where) where = ttyname(STDERR_FILENO);
23 + if (!where) where = ttyname(STDOUT_FILENO);
25 - where = "somewhere";
26 warn(_("cannot get tty name"));
27 } else if (strncmp(where, "/dev/", 5) == 0)
30 /* snprintf is not always available, but the sprintf's here
31 will not overflow as long as %d takes at most 100 chars */
32 fprintf(fp, "\r%*s\r\n", TERM_WIDTH, " ");
33 - sprintf(lbuf, _("Broadcast message from %s@%s (%s) (%s):"),
34 - whom, hostname, where, date);
35 - fprintf(fp, "%-*.*s\007\007\r\n", TERM_WIDTH, TERM_WIDTH, lbuf);
36 + fprintf(fp, _("Broadcast message from %s@%s%s%s%s on %s:"),
37 + whom, hostname, where?" (":"", where?where:"", where?")":"", date);
38 + fprintf(fp, "\007\007\r\n");
42 fprintf(fp, "%*s\r\n", TERM_WIDTH, " ");
47 * Read message from argv[]
57 * read message from <file>