[Ada] Do not expect execv to return 0
Commit Message
When spawning subprocesses with fork & execv there is no need to check
the result of execve, because it either succeeds and does not return or
fails and returns -1.
This is only a code cleanup related to the use of fork-vs-vfork in
GNATprove; behaviour is unaffected, though the GNAT runtime library
will be marginally smaller.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* adaint.c (__gnat_portable_spawn): Do not expect execv to
return 0.
(__gnat_portable_no_block_spawn): Likewise.
@@ -2424,8 +2424,10 @@ __gnat_portable_spawn (char *args[] ATTRIBUTE_UNUSED)
if (pid == 0)
{
/* The child. */
- if (execv (args[0], MAYBE_TO_PTR32 (args)) != 0)
- _exit (1);
+ execv (args[0], MAYBE_TO_PTR32 (args));
+
+ /* execv() returns only on error */
+ _exit (1);
}
/* The parent. */
@@ -2822,8 +2824,10 @@ __gnat_portable_no_block_spawn (char *args[] ATTRIBUTE_UNUSED)
if (pid == 0)
{
/* The child. */
- if (execv (args[0], MAYBE_TO_PTR32 (args)) != 0)
- _exit (1);
+ execv (args[0], MAYBE_TO_PTR32 (args));
+
+ /* execv() returns only on error */
+ _exit (1);
}
return pid;