Skip to contentSkip to conversation

selftests/mount: Use 'const' for filename parameters

PATCH New Ritvik Gupta 1 participant 1 message Feb 24, 2025 Kselftest

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/mount: Use 'const' for filename parameters

The filename parameter in write_file(), maybe_write_file(), and vmaybe_write_file() is unmodified / read-only. So, used 'const' to improve type safety.

---
 tools/testing/selftests/mount/unprivileged-remount-test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/mount/unprivileged-remount-test.c +3 -3
index d2917054fe3a..e80ac76261e7 100644
@@ -54,7 +54,7 @@ static void die(char *fmt, ...)
 	exit(EXIT_FAILURE);
 }
 
-static void vmaybe_write_file(bool enoent_ok, char *filename, char *fmt, va_list ap)
+static void vmaybe_write_file(bool enoent_ok, const char *filename, char *fmt, va_list ap)
 {
 	char buf[4096];
 	int fd;
@@ -92,7 +92,7 @@ static void vmaybe_write_file(bool enoent_ok, char *filename, char *fmt, va_list
 	}
 }
 
-static void maybe_write_file(char *filename, char *fmt, ...)
+static void maybe_write_file(const char *filename, char *fmt, ...)
 {
 	va_list ap;
 
@@ -102,7 +102,7 @@ static void maybe_write_file(char *filename, char *fmt, ...)
 
 }
 
-static void write_file(char *filename, char *fmt, ...)
+static void write_file(const char *filename, char *fmt, ...)
 {
 	va_list ap;
 
Signature · 1 line
2.48.1