From: Alejandro Colomar Date: Mon, 22 Jan 2024 21:52:59 +0000 (+0100) Subject: src/su.c: Use const_cast() to silence -Wincompatible-pointer-types-discards-qualifiers X-Git-Tag: 4.15.0-rc1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e0cdc87b729d4b7209b3ceb78ee81b8ba60f896;p=thirdparty%2Fshadow.git 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 --- diff --git a/src/su.c b/src/su.c index ba13a67dd..07f0eea19 100644 --- a/src/su.c +++ b/src/su.c @@ -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,