]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
support: Use const char * argument in support_capture_subprogram_self_sgid
authorFlorian Weimer <fweimer@redhat.com>
Tue, 20 May 2025 17:36:02 +0000 (19:36 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 20 May 2025 19:43:13 +0000 (21:43 +0200)
The function does not modify the passed-in string, so make this clear
via the prototype.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit f0c09fe61678df6f7f18fe1ebff074e62fa5ca7a)

support/capture_subprocess.h
support/support_capture_subprocess.c

index 4be430f099bcc8cd191cfb2de2b88e60132ecb0d..4229300d4b0aab293b7e0f7f7f021f61add32855 100644 (file)
@@ -44,8 +44,7 @@ struct support_capture_subprocess support_capture_subprogram
 /* Copy the running program into a setgid binary and run it with CHILD_ID
    argument.  If execution is successful, return the exit status of the child
    program, otherwise return a non-zero failure exit code.  */
-int support_capture_subprogram_self_sgid
-  (char *child_id);
+int support_capture_subprogram_self_sgid (const char *child_id);
 
 /* Deallocate the subprocess data captured by
    support_capture_subprocess.  */
index 0bacf6dbc23b0732445622bb8e07b41cfa9e53d7..6e6ac8bbb7f648599f6b2c35bc87730a897a8c9f 100644 (file)
@@ -109,7 +109,7 @@ support_capture_subprogram (const char *file, char *const argv[])
    safely make it SGID with the TARGET group ID.  Then runs the
    executable.  */
 static int
-copy_and_spawn_sgid (char *child_id, gid_t gid)
+copy_and_spawn_sgid (const char *child_id, gid_t gid)
 {
   char *dirname = xasprintf ("%s/tst-tunables-setuid.%jd",
                             test_dir, (intmax_t) getpid ());
@@ -172,7 +172,7 @@ copy_and_spawn_sgid (char *child_id, gid_t gid)
   ret = 0;
   infd = outfd = -1;
 
-  char * const args[] = {execname, child_id, NULL};
+  char * const args[] = {execname, (char *) child_id, NULL};
 
   status = support_subprogram_wait (args[0], args);
 
@@ -199,7 +199,7 @@ err:
 }
 
 int
-support_capture_subprogram_self_sgid (char *child_id)
+support_capture_subprogram_self_sgid (const char *child_id)
 {
   gid_t target = 0;
   const int count = 64;