[RFC makedumpfile: add userinfo elf section 1/4] makedumpfile: rename check_dump_file() on check_file_is_writable()

Ivan Khoronzhuk ivan.khoronzhuk at gmail.com
Wed Dec 1 05:47:27 PST 2021


Make function for checking the file can be written to be more flex
by renaming check_dump_file() on check_file_is_writable().

Signed-off-by: Ivan Khoronzhuk <ikhoronz at cisco.com>
---
 makedumpfile.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 3d1d412..6b62b92 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -1397,7 +1397,7 @@ open_dump_file(void)
 }
 
 int
-check_dump_file(const char *path)
+check_file_is_writable(const char *path)
 {
 	char *err_str;
 
@@ -1410,7 +1410,7 @@ check_dump_file(const char *path)
 	} else {
 		err_str = strerror(EEXIST);
 	}
-	ERRMSG("Can't open the dump file (%s). %s\n", path, err_str);
+	ERRMSG("Can't open the file (%s). %s\n", path, err_str);
 	return FALSE;
 }
 
@@ -11954,7 +11954,7 @@ main(int argc, char *argv[])
 		if (info->flag_check_params)
 			goto check_ok;
 
-		if (!check_dump_file(info->name_dumpfile))
+		if (!check_file_is_writable(info->name_dumpfile))
 			goto out;
 
 		if (!open_files_for_rearranging_dumpdata())
@@ -11977,7 +11977,7 @@ main(int argc, char *argv[])
 		if (info->flag_check_params)
 			goto check_ok;
 
-		if (!check_dump_file(info->name_dumpfile))
+		if (!check_file_is_writable(info->name_dumpfile))
 			goto out;
 
 		if (!reassemble_dumpfile())
@@ -11993,7 +11993,7 @@ main(int argc, char *argv[])
 		if (info->flag_check_params)
 			goto check_ok;
 
-		if (!check_dump_file(info->name_dumpfile))
+		if (!check_file_is_writable(info->name_dumpfile))
 			goto out;
 		if (!dump_dmesg())
 			goto out;
@@ -12033,11 +12033,11 @@ main(int argc, char *argv[])
 		if (info->flag_split) {
 			for (i = 0; i < info->num_dumpfile; i++) {
 				SPLITTING_FD_BITMAP(i) = -1;
-				if (!check_dump_file(SPLITTING_DUMPFILE(i)))
+				if (!check_file_is_writable(SPLITTING_DUMPFILE(i)))
 					goto out;
 			}
 		} else {
-			if (!check_dump_file(info->name_dumpfile))
+			if (!check_file_is_writable(info->name_dumpfile))
 				goto out;
 		}
 
-- 
2.20.1




More information about the kexec mailing list