]> granicus.if.org Git - strace/commit
Replace suspicious popen_pid assignment with an obviously correct one
authorDenys Vlasenko <dvlasenk@redhat.com>
Tue, 2 Jul 2013 09:31:24 +0000 (11:31 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Tue, 2 Jul 2013 09:31:24 +0000 (11:31 +0200)
commit519af5ad34fa19fb48e2bc6539135fe0852210c3
treeaae46d4b30d6950c075c8e253875680ca15eb527
parentd0ffdf494ac722f3d121c6e807f105000409e6a6
Replace suspicious popen_pid assignment with an obviously correct one

popen_pid = vfork() does work correctly, but for a subtle reason
that wrong assignment of 0 happens in the child _first_,
and _then_ correct value overwrites it in the parent.

(And in a hyphothetical system where vfork = fork,
popen_pid wouldn't be shared, so it will also be ok.)

However, it's not necessary to be difficult.
This change makes it so that assignment is done only in parent.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
strace.c