Changeset View
Changeset View
Standalone View
Standalone View
sbin/savecore/savecore.c
Show First 20 Lines • Show All 1,309 Lines • ▼ Show 20 Lines | if (caph_rights_limit(savedirfd, &rights) < 0) { | ||||
exit(1); | exit(1); | ||||
} | } | ||||
/* Enter capability mode. */ | /* Enter capability mode. */ | ||||
init_caps(argc, devs); | init_caps(argc, devs); | ||||
for (i = 0; i < argc; i++) | for (i = 0; i < argc; i++) | ||||
DoFile(savedir, savedirfd, devs[i]); | DoFile(savedir, savedirfd, devs[i]); | ||||
/* Emit minimal output. */ | |||||
if (nfound == 0) { | if (nfound == 0) { | ||||
markj: This comment should probably be deleted. | |||||
if (checkfor) { | if (checkfor) { | ||||
if (verbose) | if (verbose) | ||||
printf("No dump exists\n"); | printf("No dump exists\n"); | ||||
Done Inline Actionssavecore calls openlog() with LOG_PERROR, so messages logged with logmsg() go to standard error. So we are effectively printing the same message twice when -v is specified. markj: savecore calls openlog() with LOG_PERROR, so messages logged with logmsg() go to standard error. | |||||
Done Inline ActionsI was going to collapse them down into just one, but looking back we intentionally killed off messages in the default path back in 2015. Perhaps this change should just be dropped instead... kevans: I was going to collapse them down into just one, but looking back we intentionally killed off… | |||||
Done Inline ActionsOne can always set savecore_flags=-v in rc.conf if desired... markj: One can always set `savecore_flags=-v` in rc.conf if desired... | |||||
exit(1); | exit(1); | ||||
} | } | ||||
if (verbose) | if (verbose) | ||||
logmsg(LOG_WARNING, "no dumps found"); | logmsg(LOG_WARNING, "no dumps found"); | ||||
} else if (nsaved == 0) { | } else if (nsaved == 0) { | ||||
if (nerr != 0) { | if (nerr != 0) { | ||||
if (verbose) | if (verbose) | ||||
logmsg(LOG_WARNING, | logmsg(LOG_WARNING, | ||||
"unsaved dumps found but not saved"); | "unsaved dumps found but not saved"); | ||||
exit(1); | exit(1); | ||||
} else if (verbose) | } else if (verbose) | ||||
logmsg(LOG_WARNING, "no unsaved dumps found"); | logmsg(LOG_WARNING, "no unsaved dumps found"); | ||||
} else if (verbose) { | |||||
logmsg(LOG_NOTICE, "%d cores saved in %s\n", nsaved, savedir); | |||||
Not Done Inline ActionsWe consistently omit a period in other messages. markj: We consistently omit a period in other messages. | |||||
Done Inline ActionsShould this be using logmsg()? markj: Should this be using logmsg()? | |||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
infohandler(int sig __unused) | infohandler(int sig __unused) | ||||
{ | { | ||||
got_siginfo = 1; | got_siginfo = 1; | ||||
} | } |
This comment should probably be deleted.