From nobody Mon May 27 15:27:17 2024 X-Original-To: dev-commits-src-all@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 4VnzzB1Sg6z5LLLs; Mon, 27 May 2024 15:27:18 +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 4VnzzB0wsxz4HG5; Mon, 27 May 2024 15:27:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716823638; 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=hw3wip7p9yOGZJb2L/s/YiWRGSgiakmdej7W8WUJv8M=; b=r2QBYRcSTj8a/KOCa9K219KDEFO4QeRuILUQHBIH4FmLpHRx2R2h5MPnrwNfxDWcO8b50n OtR7BfFp7CakyE2t7ylXzjlY4GC9w9XfuTPp7jfR0DTTM1BjQoTy7xqTXh89bsVtsGZ99u JSIVtigkKwmlkKRbWL0eN//6fLrb05H6S4bqQQIgACqSOYmdmxZ/FaJX1gAJrLedivIa/E AqK2QiJX0GpBXfLKXWNPoJp5nv1r93jjONJ8qsmkEC9i2ap16y0M1nWkyTd1IiynkVMvnw isZPYt7e5sO2wgvyYpN7RhqgxZIhBbctuEepC1BDpK/0Hfroz20YOxNgfjDffA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716823638; a=rsa-sha256; cv=none; b=exeHQDpUqH4BcCt7YGtW6g0MaNmlBkDGfdRentTbiLuh2CcNVGuc+F0X4cL0Dn6MN0xElm 7ubh2xe4spQDegVXp03l9FA/wKkjB8zuwh5NQTxtZ3CcVroLmKLmaVQOjxm7RKPecTJnbw uy8xvCdN/XPVUrCNz70KzmUWdgNI56QfrWvqCcZBuQbXkXbdZy17KiTczvnaDyZOKBLo7R xk+ZJiTqKneSSzFGXnm3ie88Fvs2KrY9EX3wlN3ToRS/rQWm/uD+b3DlDjeVrmn+31n4A+ ZPCX3WiIPPovW1nAgGvOpAJrSWIVy55Cbf/sfFTvtd8GeEcD5lhrqsKMn6jwNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716823638; 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=hw3wip7p9yOGZJb2L/s/YiWRGSgiakmdej7W8WUJv8M=; b=hry0RqKWMwUlyb7zih5PpUvGf6BrufK1XLJnUKNfY1RoouQGLShKffY8aOhlHPdJDg3TOX 2F8db0EaLV1w+HOPmdaOcnF8DOZbZDACFcQanJ+oEDnr2159b4UPPGzUWsE/HCQV4tt6ZJ mm5AYUotOtd+zLBY9ITIMkxNnIRrrHk1hMy2eOz7fJ38vsod+fydodwqocF/j7Ti2RSWTW JYt2CoVl8cZ5OVvUwOYvcajQBnNoY95vjBi/bYBya9ROZ7bZiUo4y7P4MxiXclw2MpN2Fg tOAkX5//CxzFUfKTIUxFJuehFtpoPjPaFBGrlprafOAY+/b4yMrFh8LffWLaEA== 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 4VnzzB0XHJzqVD; Mon, 27 May 2024 15:27:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44RFRHuk092502; Mon, 27 May 2024 15:27:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44RFRHw7092499; Mon, 27 May 2024 15:27:17 GMT (envelope-from git) Date: Mon, 27 May 2024 15:27:17 GMT Message-Id: <202405271527.44RFRHw7092499@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 568be71de3b4 - main - stress2: Use the proper type for the getopt(3) return value List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 568be71de3b44c8c4679e4c202a782a7302426ed Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=568be71de3b44c8c4679e4c202a782a7302426ed commit 568be71de3b44c8c4679e4c202a782a7302426ed Author: Mark Johnston AuthorDate: 2024-05-25 16:52:32 +0000 Commit: Mark Johnston CommitDate: 2024-05-27 15:26:47 +0000 stress2: Use the proper type for the getopt(3) return value On arm platforms "char" is typically unsigned, in which case the test "(c = getopt(...)) != -1" does not behave as desired. Reviewed by: pho MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45365 --- tools/test/stress2/tools/flip.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/test/stress2/tools/flip.c b/tools/test/stress2/tools/flip.c index cdc2742de59f..f2a4d86e115b 100644 --- a/tools/test/stress2/tools/flip.c +++ b/tools/test/stress2/tools/flip.c @@ -85,8 +85,7 @@ main(int argc, char *argv[]) struct stat st; off_t pos; size_t size; - int fd, i, times; - char c; + int c, fd, i, times; times = 1; size = 0; @@ -126,18 +125,20 @@ main(int argc, char *argv[]) } for (i = 0; i < times; i++) { + char ch; + pos = arc4random() % size; if (lseek(fd, pos, SEEK_SET) == -1) err(1, "lseek()"); - if (read(fd, &c, 1) != 1) + if (read(fd, &ch, 1) != 1) err(1, "read()"); if (arc4random() % 100 < 98) - flip(&c, 1); + flip(&ch, 1); else - trash(&c); + trash(&ch); if (lseek(fd, pos, SEEK_SET) == -1) err(1, "lseek()"); - if (write(fd, &c, 1) != 1) + if (write(fd, &ch, 1) != 1) err(1, "write()"); }