Question about libjava/childproc.c

Martin Buchholz martinrb at google.com
Wed Sep 5 16:43:01 UTC 2018


On Wed, Sep 5, 2018 at 9:23 AM, Thomas Stüfe <thomas.stuefe at gmail.com>
wrote:

>
> Since all this happens between vfork and exec we cannot do any decent
> error handling here. Even what little we do is way outside the allowed
> spec for vfork().
>

Well we do have a fallback if closeDescriptors fails.  But on closer
inspection we don't check for error conditions in readdir

http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html

Upon successful completion, *readdir*() shall return a pointer to an object
of type *struct dirent*. When an error is encountered, a null pointer shall
be returned and *errno* shall be set to indicate the error. When the end of
the directory is encountered, a null pointer shall be returned and *errno* is
not changed.

So before the readdir loop we should set errno to 0.  Then when readdir
returns NULL, we should check whether errno is non-zero.

---

We do have a way of reporting errno to the parent.  See WhyCantJohnnyExec.


More information about the core-libs-dev mailing list