public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4676] [Ada] Do not expect execv to return 0
@ 2021-10-25 15:08 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-10-25 15:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1be75e7451b00aca32ed96be43223ee67d163429

commit r12-4676-g1be75e7451b00aca32ed96be43223ee67d163429
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Thu Apr 15 23:22:32 2021 +0200

    [Ada] Do not expect execv to return 0
    
    gcc/ada/
    
            * adaint.c (__gnat_portable_spawn): Do not expect execv to
            return 0.
            (__gnat_portable_no_block_spawn): Likewise.

Diff:
---
 gcc/ada/adaint.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 60cfa932990..6781728f45e 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-25 15:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25 15:08 [gcc r12-4676] [Ada] Do not expect execv to return 0 Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).