[PATCH 1/2] makedumpfile: Fix bad file descriptor error when using --dry-run

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When running makedumpfile with the --dry-run option it fails with

	[...]
	write_and_check_space: Can't seek the dump file(vmcore). Bad file descriptor
	[...]

This is because for --dry-run no dump file is created and a dummy file
descriptor of -1 is used. Thus the lseek in write_and_check_space will
fail. Fix this by treating a dry run as if writing to STDOUT.

Fixes: f0cfa86 ("[PATCH v2 3/3] Add -L option to limit output file size")
Signed-off-by: Philipp Rudo <prudo@xxxxxxxxxx>
---
 makedumpfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index b1b3b42..30f9725 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -4712,7 +4712,7 @@ write_and_check_space(int fd, void *buf, size_t buf_size, const char* desc,
 	int retval = 0;
 	off_t pos;
 
-	if (fd == STDOUT_FILENO) {
+	if (fd == STDOUT_FILENO || info->flag_dry_run) {
 		pos = write_bytes;
 	} else {
 		pos = lseek(fd, 0, SEEK_CUR);
-- 
2.31.1


_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux