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
This commit is contained in:
Mitchell Horne 2022-04-18 12:18:13 -03:00
parent 333f668468
commit 4243d307d3

View File

@ -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) {