summaryrefslogtreecommitdiff
path: root/usr/src/cmd/halt
diff options
context:
space:
mode:
authorsetje <none@none>2005-11-02 17:51:22 -0800
committersetje <none@none>2005-11-02 17:51:22 -0800
commitf040a7a67fcbe6fabda79a643f3fd1a520472325 (patch)
treec48629c3f4ae920bf9ec32726d3122c7465d8e41 /usr/src/cmd/halt
parentdb063408202c8a4f2d6ede8af4ea31626456a461 (diff)
downloadillumos-joyent-f040a7a67fcbe6fabda79a643f3fd1a520472325.tar.gz
4802882 /usr/sbin/reboot should log tty if there is one
6283947 Poor grammar output from the poweroff command, does not look professional
Diffstat (limited to 'usr/src/cmd/halt')
-rw-r--r--usr/src/cmd/halt/halt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr/src/cmd/halt/halt.c b/usr/src/cmd/halt/halt.c
index 942b20f838..8f61ff886f 100644
--- a/usr/src/cmd/halt/halt.c
+++ b/usr/src/cmd/halt/halt.c
@@ -617,13 +617,20 @@ main(int argc, char *argv[])
if (needlog) {
char *user = getlogin();
struct passwd *pw;
+ char *tty;
openlog(cmdname, 0, LOG_AUTH);
if (user == NULL && (pw = getpwuid(getuid())) != NULL)
user = pw->pw_name;
if (user == NULL)
user = "root";
- syslog(LOG_CRIT, "%sed by %s", cmdname, user);
+
+ tty = ttyname(1);
+
+ if (tty == NULL)
+ syslog(LOG_CRIT, "initiated by %s", user);
+ else
+ syslog(LOG_CRIT, "initiated by %s on %s", user, tty);
}
/*