Do not drop const qualifier for Basename
The private Basename() implementation does not modify its argument, so a cast to a non-const char pointer is not necessary. newgrp.c:790:39: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] 790 | progbase = (char *) Basename ((char *) prog); | ^ newgrp.c:790:20: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] 790 | progbase = (char *) Basename ((char *) prog); | ^ shell.c:48:70: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual] 48 | (void) snprintf (arg0, sizeof arg0, "-%s", Basename ((char *) file)); | ^
This commit is contained in:
@ -45,7 +45,7 @@ int shell (const char *file, /*@null@*/const char *arg, char *const envp[])
|
||||
* don't want to tell us what it is themselves.
|
||||
*/
|
||||
if (arg == (char *) 0) {
|
||||
(void) snprintf (arg0, sizeof arg0, "-%s", Basename ((char *) file));
|
||||
(void) snprintf (arg0, sizeof arg0, "-%s", Basename (file));
|
||||
arg0[sizeof arg0 - 1] = '\0';
|
||||
arg = arg0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user