summaryrefslogtreecommitdiff
path: root/lib/unlink.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-03-21 16:13:28 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-03-21 16:13:58 -0700
commit3e89c500a2f17a8a7a278390d48419990ce24bc8 (patch)
tree3abb59fbd6a777b6f7fd428096ea8b59a257580b /lib/unlink.c
parent360979fd6fb84567e0ffc6839b0431fc00d6362f (diff)
downloadgnulib-3e89c500a2f17a8a7a278390d48419990ce24bc8.tar.gz
unlink: fix malloc errno typo
Problem reported by Tim Rühsen in: https://lists.gnu.org/r/bug-gnulib/2020-03/msg00044.html * lib/unlink.c (rpl_unlink): Don’t mask malloc errno.
Diffstat (limited to 'lib/unlink.c')
-rw-r--r--lib/unlink.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/unlink.c b/lib/unlink.c
index b7daa7cd36..5e0f4e177d 100644
--- a/lib/unlink.c
+++ b/lib/unlink.c
@@ -65,10 +65,7 @@ rpl_unlink (char const *name)
/* Trailing NUL will overwrite the trailing slash. */
char *short_name = malloc (len);
if (!short_name)
- {
- errno = EPERM;
- return -1;
- }
+ return -1;
memcpy (short_name, name, len);
while (len && ISSLASH (short_name[len - 1]))
short_name[--len] = '\0';