This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: strerror_r() between fork and exec?
- From: Steven Stewart-Gallus <sstewartgallus00 at mylangara dot bc dot ca>
- To: arequipeno at gmail dot com
- Cc: libc-help at sourceware dot org
- Date: Tue, 09 Sep 2014 17:21:00 +0000 (GMT)
- Subject: Re: strerror_r() between fork and exec?
- Authentication-results: sourceware.org; auth=none
- References: <1410212326 dot 8029 dot ezmlm at sourceware dot org>
Hello, as you can see in the manual (at
http://www.gnu.org/software/libc/manual/html_mono/libc.html#index-strerror_005fr)
strerror_r is not safe in such a situation. The usual trick in such a
situation is to use a pipe to report back the error code to the
parent. If you really cannot use such a trick then one hack you might
be able to do is to fork an initial zygote process from before you
start using multithreaded functions and then spawn off forks of that
process instead of your latest one. These are just a few potential
approaches though and I would need to more about your particular
situation before I could give you better help.
Thank you,
Steven Stewart-Gallus