summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-09-09 14:32:21 +0000
committerBruno Haible <bruno@clisp.org>2007-09-09 14:32:21 +0000
commit9c3b84f6998862213327398e68fdda4c5a508a6f (patch)
tree2b16a81570b2f6a86f38eecad8c8ac9fbf596cda /lib
parent3122117a737aa7a8cc4c699115682090c473407e (diff)
downloadgnulib-9c3b84f6998862213327398e68fdda4c5a508a6f.tar.gz
Set errno to ENOMEM when malloc/realloc fails. Needed on mingw.
Diffstat (limited to 'lib')
-rw-r--r--lib/canonicalize-lgpl.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index 14dd536dc4..2ed149bcb0 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -135,7 +135,12 @@ __realpath (const char *name, char *resolved)
{
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 @@ __realpath (const char *name, char *resolved)
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;