svn commit: r244216 - head/sbin/savecore
Pawel Jakub Dawidek
pjd at FreeBSD.org
Fri Dec 14 15:03:13 UTC 2012
Author: pjd
Date: Fri Dec 14 15:03:12 2012
New Revision: 244216
URL: http://svnweb.freebsd.org/changeset/base/244216
Log:
If we are not going to clear the dump (we are either just checking if the dump
exists or we want to keep it), open device read-only.
Obtained from: WHEEL Systems
Modified:
head/sbin/savecore/savecore.c
Modified: head/sbin/savecore/savecore.c
==============================================================================
--- head/sbin/savecore/savecore.c Fri Dec 14 15:01:23 2012 (r244215)
+++ head/sbin/savecore/savecore.c Fri Dec 14 15:03:12 2012 (r244216)
@@ -394,7 +394,7 @@ DoFile(const char *savedir, const char *
if (verbose)
printf("checking for kernel dump on device %s\n", device);
- fd = open(device, O_RDWR);
+ fd = open(device, (checkfor || keep) ? O_RDONLY : O_RDWR);
if (fd < 0) {
syslog(LOG_ERR, "%s: %m", device);
return;
@@ -612,7 +612,7 @@ DoFile(const char *savedir, const char *
printf("dump saved\n");
nuke:
- if (clear || !keep) {
+ if (!keep) {
if (verbose)
printf("clearing dump header\n");
memcpy(kdhl.magic, KERNELDUMPMAGIC_CLEARED, sizeof kdhl.magic);
More information about the svn-src-head
mailing list