Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Apr 2022 15:57:01 GMT
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4243d307d397 - main - savecore: fold maxdumps check into getbounds()
Message-ID:  <202204181557.23IFv19j031429@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=4243d307d397dedb2161499742288450fd311e1b

commit 4243d307d397dedb2161499742288450fd311e1b
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-04-18 15:18:13 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202204181557.23IFv19j031429>