mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
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
This commit is contained in:
parent
26ef9e4a3f
commit
410604696d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244216
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue