From nobody Sat Mar 12 16:50:30 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id BF8F71A12144; Sat, 12 Mar 2022 16:50:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KG81f50f3z4dmm; Sat, 12 Mar 2022 16:50:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647103830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+o5saN4c1OriqE7lCu/7I2Y6kBHNj65+gs5CzHcQkrU=; b=He+g2iXuqRxUwGSsil3YquH6Qb9oYUdlQi3PrY6CMfIQY50f4cety4xUnNsz3D58tt+7HX XFcaJIkgpGu1IwkxurgQEp0Nl+RqrCpcjTWnUhaRZ/iugb0/zKMLJ/gP7pkztf6/D9nROW /dfuf4jbvN3tNvTTQxFaaH4QVt0sXrjwRolUfnkxVYMibrN+0DJVy3IExEUdNm3tiCv8hF +luETtKoa0wjEBOTXkdQOOvnrtzMpYEL9YkDqLiX0k/v1ArS+kcQG7RpW6+tJwl2bo7C+8 pDKXTBC+bCLMvuDdEx2ehnSagrk9WuZLTV+kdN5nfhxYiFdnI9Ksqs8WgS4mLA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BBB46BE; Sat, 12 Mar 2022 16:50:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22CGoUGO050137; Sat, 12 Mar 2022 16:50:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22CGoUO7050136; Sat, 12 Mar 2022 16:50:30 GMT (envelope-from git) Date: Sat, 12 Mar 2022 16:50:30 GMT Message-Id: <202203121650.22CGoUO7050136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Steve Wills Subject: git: db11c57a6cf3 - main - usr.bin/who.c: Fix boot time checking List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: swills X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db11c57a6cf3053fb09185975cfbe3729f2fbe44 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647103830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+o5saN4c1OriqE7lCu/7I2Y6kBHNj65+gs5CzHcQkrU=; b=gtUnL3lJXEIWaK/oQOG0/3aEloXjED45NUjbBo3G6gpJUX6/dEY5EVqKbs7/1fm+gnMkEG MFWk9gUhPb5SZcJPlbl8jGbn5cuTzPwZukq4KEuPvejGIZP3pwD2UF5BDXsUyNmO/IAU9G kSLJBxLcf9Tq0oX1JoGGA9yrfoMZforp/u6D0b0t5qInEq8ZgkOoqwsk5Cwd7adtZ62LUM Wadz9XTZEG4zmtORFZ/Vl311SUPXt2gDXNde9nrBZXnWWLAue0Gz60jyGglnUBNYeEVN+E p8LaW28kygcoQnLCRBRt+Wk+2H2EPgDlATbsChkgOSijr5SEY7NQ347JXTy9Cg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647103830; a=rsa-sha256; cv=none; b=aFzWqH8iTgvrSMynCkyPi4m2UlcxBprhh/ipEGLhkvKCcNbdnxayl4VlMYYiLzHwJOJutM SgQEQ2nlfcb05/v3+an8egEXsMcDMXdooM6GEXdpUz4cH68uREuDrTjSmb7VVkN7bQvWNb HIwTBC3lg8xxyJgJtNExphqu9RC+4yyuP00QG8AHQN+YgIwKN1bcVzta2ilVFSCXgu+aNe XWNShy5ZoiMAkwkBLb0mJRaCt4ZmL6+UxmOLTWIlvIl/wedRBUBaNgWuocmbuaozt4Wqic jteTE8nAQa2ebbMubd+OerH14cHTHyvjwZQRAf3GKsnKj230ClK9knduXsMzGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by swills (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=db11c57a6cf3053fb09185975cfbe3729f2fbe44 commit db11c57a6cf3053fb09185975cfbe3729f2fbe44 Author: Steve Wills AuthorDate: 2022-03-12 16:48:24 +0000 Commit: Steve Wills CommitDate: 2022-03-12 16:49:49 +0000 usr.bin/who.c: Fix boot time checking The boot time entry doesn't have a tty specified, so don't check it. While here, make ttystat handle that case. Approved by: kevans (src) Differential Revision: https://reviews.freebsd.org/D34524 --- usr.bin/who/who.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usr.bin/who/who.c b/usr.bin/who/who.c index 6ad4f18c3b78..add2fb27a27a 100644 --- a/usr.bin/who/who.c +++ b/usr.bin/who/who.c @@ -216,6 +216,8 @@ ttystat(char *line) struct stat sb; char ttybuf[MAXPATHLEN]; + if (line == NULL) + return (0); (void)snprintf(ttybuf, sizeof(ttybuf), "%s%s", _PATH_DEV, line); if (stat(ttybuf, &sb) == 0) { return (0); @@ -229,10 +231,11 @@ process_utmp(void) struct utmpx *utx; while ((utx = getutxent()) != NULL) { - if (((aflag || !bflag) && utx->ut_type == USER_PROCESS) || - (bflag && utx->ut_type == BOOT_TIME)) + if ((aflag || !bflag) && utx->ut_type == USER_PROCESS) { if (ttystat(utx->ut_line) == 0) row(utx); + } else if (bflag && utx->ut_type == BOOT_TIME) + row(utx); } }