=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/write/write.c,v retrieving revision 1.33 retrieving revision 1.34 diff -c -r1.33 -r1.34 *** src/usr.bin/write/write.c 2016/02/05 19:00:39 1.33 --- src/usr.bin/write/write.c 2018/09/18 03:10:53 1.34 *************** *** 1,4 **** ! /* $OpenBSD: write.c,v 1.33 2016/02/05 19:00:39 martijn Exp $ */ /* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: write.c,v 1.34 2018/09/18 03:10:53 millert Exp $ */ /* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */ /* *************** *** 224,243 **** void do_write(char *tty, char *mytty, uid_t myuid) { ! char *login, *nows; ! struct passwd *pwd; time_t now; char path[PATH_MAX], host[HOST_NAME_MAX+1], line[512]; gid_t gid; int fd; /* Determine our login name before the we reopen() stdout */ ! if ((login = getlogin()) == NULL) { ! if ((pwd = getpwuid(myuid))) ! login = pwd->pw_name; ! else ! login = "???"; ! } (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty); fd = open(path, O_WRONLY, 0666); --- 224,239 ---- void do_write(char *tty, char *mytty, uid_t myuid) { ! const char *login; ! char *nows; time_t now; char path[PATH_MAX], host[HOST_NAME_MAX+1], line[512]; gid_t gid; int fd; /* Determine our login name before the we reopen() stdout */ ! if ((login = getlogin()) == NULL) ! login = user_from_uid(myuid, 0); (void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty); fd = open(path, O_WRONLY, 0666);