[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Remove dependency of getdelim on realloc-posix
From: |
Bruno Haible |
Subject: |
Re: Remove dependency of getdelim on realloc-posix |
Date: |
Thu, 18 Aug 2016 12:24:48 +0200 |
User-agent: |
KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; ) |
Hi Paul,
> Thanks for reporting that. I installed into Gnulib the attached
> somewhat-more-elaborate patch, which should fix the problem.
The change in lib/canonicalize-lgpl.c line 288 (after the 'malloca'
call) looks like a mistake to me. malloca() is not specified to
set errno upon failure (see lib/malloca.h line 53) and in fact
does not set errno upon failure through integer-overflow (see
lib/malloca.c line 103). The hunk
@@ -278,7 +285,7 @@ __realpath (const char *name, char *resolved)
buf = malloca (path_max);
if (!buf)
{
- errno = ENOMEM;
+ alloc_failed ();
goto error;
}
has thus removed the 'errno = ENOMEM;' statement on Unix platforms.
I think the correction should be to put back the errno = ENOMEM;
statement (in __set_errno disguise, if you prefer that).
Bruno