RFR: 8307990: jspawnhelper must close its writing side of a pipe before reading from it [v2]
Thomas Stuefe
stuefe at openjdk.org
Wed May 17 16:50:53 UTC 2023
On Wed, 17 May 2023 16:05:58 GMT, Volker Simonis <simonis at openjdk.org> wrote:
>> src/java.base/unix/native/jspawnhelper/jspawnhelper.c line 140:
>>
>>> 138: struct stat buf;
>>> 139: /* argv[0] contains the fd number to read all the child info */
>>> 140: int r, fdinr, fdinw, fdout;
>>
>> Since you are here, can you init these?
>
> What would be the right value to initialize them to and what would it help? We use `sscanf()` right in the following line and exit if `sscanf()` is not assigning all three values. I think that should be good enough.
I usually init fds with -1. It's mostly a protection against bitrot and general cleanliness.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13956#discussion_r1196806451
More information about the core-libs-dev
mailing list