# HG changeset patch # User Bruno Haible # Date 1189348341 0 # Node ID 178478846e9b6dc943420556d22bd4073ce1de56 # Parent d5ed7e149f0836241cdd4ad7036e85f3e31940f3 Set errno to ENOMEM when malloc/realloc fails. Needed on mingw. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-09-09 Bruno Haible + + * lib/canonicalize-lgpl.c (__realpath): Set errno to ENOMEM when + malloc or realloc fails. + 2007-09-09 Bruno Haible * modules/getcwd (Depends-on): Add malloc-posix. diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c --- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -135,7 +135,12 @@ { rpath = malloc (path_max); if (rpath == NULL) - return NULL; + { + /* It's easier to set errno to ENOMEM than to rely on the + 'malloc-posix' gnulib module. */ + errno = ENOMEM; + return NULL; + } } else rpath = resolved; @@ -209,7 +214,12 @@ new_size += path_max; new_rpath = (char *) realloc (rpath, new_size); if (new_rpath == NULL) - goto error; + { + /* It's easier to set errno to ENOMEM than to rely on the + 'realloc-posix' gnulib module. */ + errno = ENOMEM; + goto error; + } rpath = new_rpath; rpath_limit = rpath + new_size;