summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-11-14 18:42:39 +0000
committered <ed@FreeBSD.org>2010-11-14 18:42:39 +0000
commit120866d788da6f5cffcbd8531995e0512c2701a1 (patch)
treef97c3fbf624a289c2a435a48dd6fba61e7eb244a /lib/libc
parent336fd1996df470b1167f39d51c1bd90e7947c827 (diff)
downloadFreeBSD-src-120866d788da6f5cffcbd8531995e0512c2701a1.zip
FreeBSD-src-120866d788da6f5cffcbd8531995e0512c2701a1.tar.gz
Always set errno to a sane value when pututxline(3) fails.
For example, it will now return ESRCH when trying to replace a nonexistent entry with DEAD_PROCESS.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/pututxline.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/gen/pututxline.c b/lib/libc/gen/pututxline.c
index 3b2c7a8..5a9bab9 100644
--- a/lib/libc/gen/pututxline.c
+++ b/lib/libc/gen/pututxline.c
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
#include <sys/endian.h>
#include <sys/stat.h>
#include <sys/uio.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
@@ -53,6 +54,7 @@ futx_open(const char *file)
/* Safety check: never use broken files. */
if (_fstat(fd, &sb) != -1 && sb.st_size % sizeof(struct futx) != 0) {
_close(fd);
+ errno = EINVAL;
return (NULL);
}
@@ -142,6 +144,7 @@ utx_active_remove(struct futx *fu)
}
fclose(fp);
+ errno = ESRCH;
return (1);
}
OpenPOWER on IntegriCloud