summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/locale/mbtowc.c11
-rw-r--r--lib/libc/locale/mskanji.c2
-rw-r--r--lib/libc/sys/semget.213
-rw-r--r--lib/libc/sys/setuid.29
4 files changed, 24 insertions, 11 deletions
diff --git a/lib/libc/locale/mbtowc.c b/lib/libc/locale/mbtowc.c
index 70fc19e..376d6cf 100644
--- a/lib/libc/locale/mbtowc.c
+++ b/lib/libc/locale/mbtowc.c
@@ -32,6 +32,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <errno.h>
#include <stdlib.h>
#include <wchar.h>
#include "mblocal.h"
@@ -49,9 +50,15 @@ mbtowc_l(wchar_t * __restrict pwc, const char * __restrict s, size_t n, locale_t
return (0);
}
rval = XLOCALE_CTYPE(locale)->__mbrtowc(pwc, s, n, &locale->mbtowc);
- if (rval == (size_t)-1 || rval == (size_t)-2)
+ switch (rval) {
+ case (size_t)-2:
+ errno = EILSEQ;
+ /* FALLTHROUGH */
+ case (size_t)-1:
return (-1);
- return ((int)rval);
+ default:
+ return ((int)rval);
+ }
}
int
mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n)
diff --git a/lib/libc/locale/mskanji.c b/lib/libc/locale/mskanji.c
index 9fdd080..54f3276 100644
--- a/lib/libc/locale/mskanji.c
+++ b/lib/libc/locale/mskanji.c
@@ -73,7 +73,7 @@ _MSKanji_init(struct xlocale_ctype *l, _RuneLocale *rl)
l->__mbsinit = _MSKanji_mbsinit;
l->runes = rl;
l->__mb_cur_max = 2;
- l->__mb_sb_limit = 256;
+ l->__mb_sb_limit = 224;
return (0);
}
diff --git a/lib/libc/sys/semget.2 b/lib/libc/sys/semget.2
index 945044d..debcf11 100644
--- a/lib/libc/sys/semget.2
+++ b/lib/libc/sys/semget.2
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 12, 1995
+.Dd February 7, 2016
.Dt SEMGET 2
.Os
.Sh NAME
@@ -132,6 +132,17 @@ already exists.
.It Bq Er EINVAL
The number of semaphores requested exceeds the system imposed maximum
per set.
+.It Bq Er EINVAL
+A semaphore set corresponding to
+.Fa key
+already exists and contains fewer semaphores than
+.Fa nsems .
+.It Bq Er EINVAL
+A semaphore set corresponding to
+.Fa key
+does not exist and
+.Fa nsems
+is 0 or negative.
.It Bq Er ENOSPC
Insufficiently many semaphores are available.
.It Bq Er ENOSPC
diff --git a/lib/libc/sys/setuid.2 b/lib/libc/sys/setuid.2
index 4c7d5ad..54d89bc 100644
--- a/lib/libc/sys/setuid.2
+++ b/lib/libc/sys/setuid.2
@@ -28,7 +28,7 @@
.\" @(#)setuid.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd September 13, 2015
.Dt SETUID 2
.Os
.Sh NAME
@@ -178,15 +178,10 @@ pseudocode(void)
int fd;
/* ... */
- fd = open("/path/to/sensitive/data", O_RDWR);
+ fd = open("/path/to/sensitive/data", O_RDWR | O_CLOEXEC);
if (fd == -1)
err(1, "open");
- /*
- * Set close-on-exec flag; see fcntl(2) for more information.
- */
- if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
- err(1, "fcntl(F_SETFD)");
/* ... */
execve(path, argv, environ);
}
OpenPOWER on IntegriCloud