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


Reply via email to