src/su.c: Use const_cast() to silence -Wincompatible-pointer-types-discards-qualifiers

argv is passed to execve(3), which for historic reasons is non-const,
but doesn't modify the strings.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-01-22 22:52:59 +01:00
committed by Iker Pedrosa
parent e9fc8fc7ef
commit 3e0cdc87b7

View File

@@ -48,6 +48,7 @@
#include "alloc.h"
#include "attr.h"
#include "cast.h"
#include "prototypes.h"
#include "defines.h"
#include "pwauth.h"
@@ -1228,7 +1229,7 @@ int main (int argc, char **argv)
* Use the shell and create an argv
* with the rest of the command line included.
*/
argv[-1] = cp;
argv[-1] = const_cast(char *, cp);
execve_shell (shellstr, &argv[-1], environ);
err = errno;
(void) fprintf (stderr,