bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/111585] java.lang.Process does not fail when running a no


From: guillerodriguez.dev at gmail dot com
Subject: [Bug classpath/111585] java.lang.Process does not fail when running a non-existing binary
Date: Mon, 25 Sep 2023 08:47:14 +0000

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111585

--- Comment #1 from Guillermo Rodriguez <guillerodriguez.dev at gmail dot com> 
---
This behaviour is casued by this code in the cpproc_forkAndExec() function, in
native/jni/native-lib/cpproc.c:

```
  [...]
  pid = fork();

  switch (pid)
    {
    case 0:
      /* child */   
      [...]

      i = chdir(wd);
      /* FIXME: Handle the return value */
      if (newEnviron == NULL)
        execvp(commandLine[0], commandLine);
      else
        execve(commandLine[0], commandLine, newEnviron);

      abort();

      break;
    case -1:
      /* error */
      [...]

    default: 
      /* parent */
      [...]
      *out_pid = pid;
      return 0;
    }
```

The execvp/execve call fails, so the child calls abort. The negative value
returned by Process.waitFor means that the child died due to a signal, in this
case SIGABRT.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]