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.
This commit is contained in:
parent
336fd1996d
commit
120866d788
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user