From nobody Mon Apr 18 15:57:01 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 D077711C999C; Mon, 18 Apr 2022 15:57:01 +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 4Khs4s5YPSz4mb4; Mon, 18 Apr 2022 15:57:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650297421; 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=guzgMmF3rzfp6eobBcDsyXOxzHFZEkaHVu4wTKJziTw=; b=AZj2WKu+adTFtsYrBlSbQnAX4RNIOoQFaPaBMEqBmDIgfUSqPOghjOQSXvs2gTy6Af6LeZ XNEXG+9wzdARS3rNPnNuUmFmPwQTIF36JIjZsOjgZHxURaV60q7GJIRiI6kQz+RKLIFekY 2RR5zpsT3JBhglPGRr4FAVmxOXk56hePU5qPr7F0haS9ieO7PWrDZLWB/Fn2yG8Gp5CenO quZ530kDBuOH6NcfIQVeLwqowui937Q9V+Gn7jxMCb2Rcp1pycATdO/yAFKtTteL0stuhQ f/PMEcgM+WW2wnEvDI/eTit0a0Ct/8XxTcVmzfHvraX1Ba0wunMWJmblZf6Tjg== 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 9B1D8159FD; Mon, 18 Apr 2022 15:57:01 +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 23IFv1mM031430; Mon, 18 Apr 2022 15:57:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23IFv19j031429; Mon, 18 Apr 2022 15:57:01 GMT (envelope-from git) Date: Mon, 18 Apr 2022 15:57:01 GMT Message-Id: <202204181557.23IFv19j031429@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 4243d307d397 - main - savecore: fold maxdumps check into getbounds() 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4243d307d397dedb2161499742288450fd311e1b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650297421; 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=guzgMmF3rzfp6eobBcDsyXOxzHFZEkaHVu4wTKJziTw=; b=iAuz8Sa2Q3Xz1S/iZx69C5UdzleTdjAcz2iqjS7zhuyfmOK33b17AnPy3JSxHW7lEGWIvP 4Ccri9+epyjpN5FaPMQrHn76Qf+ijRS2cfWadIWArM+bjol8WCKk3ByGOWnqdisCOwEfP5 IhS1rxN/bY+PL73kj6gDCwrsc1ImbJSO09Y05Oz08Ot9laPkMqiDIKNiO/iUxrd6om1tXB H3EtFfcSzSACQy8p4M3uegk1sSdLEuHSeU0ai150r4Lvu1uEYWk13MGIUYFclbK1eINkic JR5456vmzI5yRtkUtF1CcFSs+2XV/HsXbLj43xJazHEcvD8sRnS0751CQYAicg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650297421; a=rsa-sha256; cv=none; b=YGaRTPbzlcaEBv5pLk9Y1mCMMVFVi3DuNL8xN/KaGR4mOwQ7RBEmP55w7jtwTjCYyUTSdj cQdijM7dC92LfIECRPc7ckQT1NHYAmOz0efJcO23YGn2xHqYPdVm8FYFLg3/vJt/204BBQ /ma+8DXezWpE4X4aJnPHL2CkyhvWaHbHG6CkP3HtnlOHv17/bzS4zq8AgQ5m1oVPNemEFw 7kNJ2w6P1THEpu+ngZEWWRYiRiGN/iWFAYU9CxbqHhqr7UR0mq+9BvtFWTbnLvpGbTEiso f3W0pUU2mxsJ24dUXKRGeHhCjxbyyEDAziDiHwLtk2EQGvOJQkqblzv6GLI4uQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=4243d307d397dedb2161499742288450fd311e1b commit 4243d307d397dedb2161499742288450fd311e1b Author: Mitchell Horne AuthorDate: 2022-04-18 15:18:13 +0000 Commit: Mitchell Horne CommitDate: 2022-04-18 15:56:15 +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 --- 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 544dade44af0..7f84f8805659 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) {