diff options
author | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2012-12-14 15:03:12 +0000 |
---|---|---|
committer | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2012-12-14 15:03:12 +0000 |
commit | 410604696d3c08a05add9da29d3342c816fddc5b (patch) | |
tree | 7eb12c150bc8657986025af676fe01b2ccd8a32f /sbin | |
parent | 26ef9e4a3f543edd87ea560aab96eebc9b7be406 (diff) | |
download | src-410604696d3c08a05add9da29d3342c816fddc5b.tar.gz src-410604696d3c08a05add9da29d3342c816fddc5b.zip |
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
Notes
Notes:
svn path=/head/; revision=244216
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/savecore/savecore.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index bbde36cbab2b..2b9b6d8671a5 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -394,7 +394,7 @@ DoFile(const char *savedir, const char *device) 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 *device) 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); |