Paul Eggert wrote:
> int
> main ()
> {
> - char *argv[3] = { (char *) BOURNE_SHELL, (char *) CHILD_PROGRAM_FILENAME,
> NULL };
> + char argv0[] = BOURNE_SHELL;
> + char argv1[] = CHILD_PROGRAM_FILENAME;
> + char *argv[] = { argv0, argv1, NULL };
> int ofd[2];
> sigset_t blocked_signals;
> sigset_t fatal_signal_set;
On this one, I would argue that the original code was correct: None of the exec*
and posix_spawn* functions writes into the argv[] strings. Therefore they are
in fact 'char const **'. It's only the insufficient C language — that complains
about casting a 'char **' to a 'char const **' — that prevents the exec* and
posix_spawn* functions from having a correct prototype.
Fortunately this is on the way of being fixed. Thanks to Alejandro for
N3749 [1] !
Bruno
[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3749.txt