[m-rev.] diff: fix segmentation fault in runtime on Mac OS X
Peter Wang
novalazy at gmail.com
Thu Jun 26 16:33:33 AEST 2014
On Thu, 26 Jun 2014 16:01:12 +1000 (EST), Julien Fischer <jfischer at opturion.com> wrote:
>
> On Thu, 26 Jun 2014, Peter Wang wrote:
>
> > On Thu, 26 Jun 2014 14:43:58 +1000 (EST), Julien Fischer <jfischer at opturion.com> wrote:
> >> Hi Peter,
> >>
> >> On Thu, 26 Jun 2014, Peter Wang wrote:
> >>
> >>> What a mess.
> >>
> >> Indeed. (Although not quite as bad as trying to get the Unicode version
> >> of the argument vector on Windows.)
> >>
> >>> Presumably all libraries other the glibc provide the standard
> >>> strerror_r, so the patch below should be less fragile.
> >>
> >> features.h is not a standard header, so the patch below is simply
> >> likely to break on systems that don't provide it (i.e. my laptop).
> >
> > Ok, we shouldn't include features.h explicitly but __GNU_LIBRARY__
> > should be defined after including string.h where strerror_r lives.
>
> I'm don't understand, do you mean mercury_runtime_util should define
> __GNU_LIBRARY__, what would that achieve?
I mean that we can just #include <string.h> then test for
__GNU_LIBRARY__ afterwards.
>
> > We could also forgo strerror_r completely and just use strerror_l or
> > sys_errlist.
>
> On OS X, the former doesn't exist and use of the latter is deprecated.
Ok.
sys_errlist seems to be deprecated everywhere but it's supposed to be
widely available. I'm trying to figure out if there is any real
disadvantage to using sys_errlist with glibc.
Peter
More information about the reviews
mailing list