From nobody Mon May 16 13:51:17 2022 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 32EB81B355AE; Mon, 16 May 2022 13:51: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 4L20yt105Xz3Glm; Mon, 16 May 2022 13:51:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652709078; 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=+HzOo9ZW0UJOIzNwrayXL1XNrk4QRU27pIR3XNGFeD8=; b=euXafMMw7CzCIsSRHlGQElswp6ik1OVQMXi3UP37KPXepN0uO0Wq/2yre466Aa956I2zKr dwXT1wS/Fc1nE8lYyC4wQp1XWEwuur3T+LAT7XX0dcSu4zwKLY2EHvwswNhOzdcz+XUsPt MPH84Ar7vq9mZonM68+CRXwPhlFtpf4qjQy8pYmg/LI1deN3KbRFnGoJTWGNNWlCWCOKBO faWke5/VVeKw2Yw6qshTtaw/FLpwAfpiLkpi3t4Xm/eelB9w58CN2zPiLfT6Pe+pyLMQXY kP+smIGc1RYq6oY7Gwn0MmrM0GsQKbWiJumJKPKOa976IJU6tAUz2yz1h6lg+Q== 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 01DE6213D3; Mon, 16 May 2022 13:51:18 +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 24GDpHLE079635; Mon, 16 May 2022 13:51:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24GDpH6W079634; Mon, 16 May 2022 13:51:17 GMT (envelope-from git) Date: Mon, 16 May 2022 13:51:17 GMT Message-Id: <202205161351.24GDpH6W079634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 1961b4605913 - stable/13 - savecore: fold maxdumps check into getbounds() 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1961b4605913e6fc98b6cce08e8078e034ea255f Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652709078; 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=+HzOo9ZW0UJOIzNwrayXL1XNrk4QRU27pIR3XNGFeD8=; b=dshZEP4c97vtoL8cWvVfUCZvcTy7p7UPzGdrksYXw/Izmfh3GsyV7kOjtrsbaIp2T+Ce4A MYxB6n6uM3eoShZayH5rqCT8apuLYI5inRw1+pj7GO5nW/c0F0eHedk1MmoioaLR21cRRO 7LksTevLBnw9cVaGg2B1hynjpu6kjyWVAQDhQTF4wrKI784Qb6PfDBbyjw6WigEK7Tj9Ez 5N83ww0jnB8eI8cIqpDMWuQg9URuWpkUUB71l4pcS8agb/9UqqQIAMKLFMhn6aUv5GTEja QvkytOJXoQGgJBlf5oKvdFW1neF95AabJaKh2rApcx2s2OT66mcrAfpM/CJu2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652709078; a=rsa-sha256; cv=none; b=g/6E7C07w61HNB6X8FM/tHF3vNp96gFpP/QUXIsrxJOkG2tgEl63zJ6DNxs2XVkiyfTzH4 U2/uAXgP3fs2jLX/gQLKAQlemq/dgRzsZWkddwukXN9rsuep0SP/mPXEWPyH5EHozcz6MD 49LDg78iDyEQ0vIDchuDzF5gz1WnHA655WGfPQhnqXdYcSUkoqbDH7RxFckk4sQz6SecOv I2+lPc2fqhSrnE7a16oudlFuT2N/+I8QVGhZj/yww5cplg+spq14wtMW5Jc23Yu+dgW8qv NHTt+qWExVo6RW8Qv+X/dXY9eIOubO4cXFssNNfq+0DFvgtAaGS69UHH6R8fXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=1961b4605913e6fc98b6cce08e8078e034ea255f commit 1961b4605913e6fc98b6cce08e8078e034ea255f Author: Mitchell Horne AuthorDate: 2022-04-18 15:18:13 +0000 Commit: Mitchell Horne CommitDate: 2022-05-16 13:34:03 +0000 savecore: fold maxdumps check into getbounds() So that new callers of getbounds() don't need to duplicate it. Reviewed by: markj MFC after: 3 days Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D34783 (cherry picked from commit 4243d307d397dedb2161499742288450fd311e1b) --- sbin/savecore/savecore.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index fddeaf6e284f..755fef6bf31d 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -257,6 +257,8 @@ getbounds(int savedirfd) ret = (int)strtol(buf, NULL, 10); if (ret == 0 && (errno == EINVAL || errno == ERANGE)) logmsg(LOG_WARNING, "invalid value found in bounds, using 0"); + if (maxdumps > 0 && ret == maxdumps) + ret = 0; fclose(fp); return (ret); } @@ -721,9 +723,6 @@ DoFile(const char *savedir, int savedirfd, const char *device) return; } - if (maxdumps > 0 && bounds == maxdumps) - bounds = 0; - if (buf == NULL) { buf = malloc(BUFFERSIZE); if (buf == NULL) {