summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-02-22 16:04:37 +0000
committerdim <dim@FreeBSD.org>2015-02-22 16:04:37 +0000
commit9bd5a747dd2c968d97a8932065fb94723bbeae9c (patch)
tree62a36bf13e95aeb90982314c4943a29b289e60ee /lib
parent1e024675bcd5e4ace8bffb2dd6afd3fa8b8ad7f3 (diff)
parent88c4104dd7fac3a58708a6de5dcd21610a7f0316 (diff)
downloadFreeBSD-src-9bd5a747dd2c968d97a8932065fb94723bbeae9c.zip
FreeBSD-src-9bd5a747dd2c968d97a8932065fb94723bbeae9c.tar.gz
Merge ^/head r279023 through r279162.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/db/man/dbm.36
-rw-r--r--lib/libc/gen/getgrent.c4
-rw-r--r--lib/libc/gen/getpwent.c4
-rw-r--r--lib/libc/gen/nice.325
-rw-r--r--lib/libc/gen/nice.c12
-rw-r--r--lib/libc/gen/setmode.c4
-rw-r--r--lib/libc/regex/engine.c4
-rw-r--r--lib/libc/regex/regcomp.c4
-rw-r--r--lib/msun/src/e_j0.c2
-rw-r--r--lib/msun/src/e_j0f.c2
-rw-r--r--lib/msun/src/e_j1.c2
-rw-r--r--lib/msun/src/e_j1f.c2
12 files changed, 50 insertions, 21 deletions
diff --git a/lib/libc/db/man/dbm.3 b/lib/libc/db/man/dbm.3
index fabce8a..eedf804 100644
--- a/lib/libc/db/man/dbm.3
+++ b/lib/libc/db/man/dbm.3
@@ -15,7 +15,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 16, 2006
+.Dd February 19, 2015
.Dt DBM 3
.Os
.Sh NAME
@@ -174,9 +174,7 @@ deletes the entry for
The
.Fn dbm_delete
function
-normally returns zero but returns 1 if there was no entry with
-.Fa key
-in the database or returns -1 and sets
+normally returns zero or returns -1 and sets
.Va errno
if there were any errors.
.Pp
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index 4ba24ae..1f4d7e9 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -1173,8 +1173,10 @@ nis_group(void *retval, void *mdata, va_list ap)
* terminator, alignment padding, and one (char *)
* pointer for the member list terminator.
*/
- if (resultlen >= bufsize - _ALIGNBYTES - sizeof(char *))
+ if (resultlen >= bufsize - _ALIGNBYTES - sizeof(char *)) {
+ free(result);
goto erange;
+ }
memcpy(buffer, result, resultlen);
buffer[resultlen] = '\0';
free(result);
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index 6cd7eaf..0cb8ed2 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -1392,8 +1392,10 @@ nis_passwd(void *retval, void *mdata, va_list ap)
continue;
}
}
- if (resultlen >= bufsize)
+ if (resultlen >= bufsize) {
+ free(result);
goto erange;
+ }
memcpy(buffer, result, resultlen);
buffer[resultlen] = '\0';
free(result);
diff --git a/lib/libc/gen/nice.3 b/lib/libc/gen/nice.3
index 9c39b78..3bad5f7 100644
--- a/lib/libc/gen/nice.3
+++ b/lib/libc/gen/nice.3
@@ -28,7 +28,7 @@
.\" @(#)nice.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd February 22, 2015
.Dt NICE 3
.Os
.Sh NAME
@@ -57,11 +57,34 @@ Only the super-user may lower priorities.
.Pp
Children inherit the priority of their parent processes via
.Xr fork 2 .
+.Sh RETURN VALUES
+Upon successful completion,
+.Fn nice
+returns the new nice value minus
+.Dv NZERO .
+Otherwise, \-1 is returned, the process' nice value is not changed, and
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn nice
+function will fail if:
+.Bl -tag -width Er
+.It Bq Er EPERM
+The
+.Fa incr
+argument is negative and the caller does not have appropriate privileges.
+.El
.Sh SEE ALSO
.Xr nice 1 ,
.Xr fork 2 ,
.Xr setpriority 2 ,
.Xr renice 8
+.Sh STANDARDS
+The
+.Fn nice
+function conforms to
+.St -xpg4.2 .
.Sh HISTORY
A
.Fn nice
diff --git a/lib/libc/gen/nice.c b/lib/libc/gen/nice.c
index e8375e8..58cde98 100644
--- a/lib/libc/gen/nice.c
+++ b/lib/libc/gen/nice.c
@@ -43,14 +43,18 @@ __FBSDID("$FreeBSD$");
* Backwards compatible nice.
*/
int
-nice(incr)
- int incr;
+nice(int incr)
{
int prio;
errno = 0;
prio = getpriority(PRIO_PROCESS, 0);
if (prio == -1 && errno)
- return (-1);
- return (setpriority(PRIO_PROCESS, 0, prio + incr));
+ return -1;
+ if (setpriority(PRIO_PROCESS, 0, prio + incr) == -1) {
+ if (errno == EACCES)
+ errno = EPERM;
+ return -1;
+ }
+ return getpriority(PRIO_PROCESS, 0);
}
diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c
index 3966fd0..ffa20fd 100644
--- a/lib/libc/gen/setmode.c
+++ b/lib/libc/gen/setmode.c
@@ -186,10 +186,10 @@ setmode(const char *p)
* as best we can.
*/
sigfillset(&sigset);
- (void)_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
+ (void)_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
(void)umask(mask = umask(0));
mask = ~mask;
- (void)_sigprocmask(SIG_SETMASK, &sigoset, NULL);
+ (void)_sigprocmask(SIG_SETMASK, &sigoset, NULL);
setlen = SET_LEN + 2;
diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c
index 589bb9d..436370d 100644
--- a/lib/libc/regex/engine.c
+++ b/lib/libc/regex/engine.c
@@ -157,7 +157,7 @@ matcher(struct re_guts *g,
int i;
struct match mv;
struct match *m = &mv;
- const char *dp;
+ const char *dp = NULL;
const sopno gf = g->firststate+1; /* +1 for OEND */
const sopno gl = g->laststate;
const char *start;
@@ -244,7 +244,7 @@ matcher(struct re_guts *g,
ZAPSTATE(&m->mbs);
/* Adjust start according to moffset, to speed things up */
- if (g->moffset > -1)
+ if (dp != NULL && g->moffset > -1)
start = ((dp - g->moffset) < start) ? start : dp - g->moffset;
SP("mloop", m->st, *start);
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index ae92f6a..2da5066 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -1422,8 +1422,8 @@ static void
findmust(struct parse *p, struct re_guts *g)
{
sop *scan;
- sop *start;
- sop *newstart;
+ sop *start = NULL;
+ sop *newstart = NULL;
sopno newlen;
sop s;
char *cp;
diff --git a/lib/msun/src/e_j0.c b/lib/msun/src/e_j0.c
index a1ac7c7..8fd2a9b 100644
--- a/lib/msun/src/e_j0.c
+++ b/lib/msun/src/e_j0.c
@@ -278,7 +278,7 @@ static const double pS2[5] = {
if(ix>=0x40200000) {p = pR8; q= pS8;}
else if(ix>=0x40122E8B){p = pR5; q= pS5;}
else if(ix>=0x4006DB6D){p = pR3; q= pS3;}
- else if(ix>=0x40000000){p = pR2; q= pS2;}
+ else {p = pR2; q= pS2;} /* ix>=0x40000000 */
z = one/(x*x);
r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
diff --git a/lib/msun/src/e_j0f.c b/lib/msun/src/e_j0f.c
index f7c463b..75563ef 100644
--- a/lib/msun/src/e_j0f.c
+++ b/lib/msun/src/e_j0f.c
@@ -234,7 +234,7 @@ static const float pS2[5] = {
if(ix>=0x41000000) {p = pR8; q= pS8;}
else if(ix>=0x40f71c58){p = pR5; q= pS5;}
else if(ix>=0x4036db68){p = pR3; q= pS3;}
- else if(ix>=0x40000000){p = pR2; q= pS2;}
+ else {p = pR2; q= pS2;} /* ix>=0x40000000 */
z = one/(x*x);
r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
diff --git a/lib/msun/src/e_j1.c b/lib/msun/src/e_j1.c
index 63800ad..6d07b61 100644
--- a/lib/msun/src/e_j1.c
+++ b/lib/msun/src/e_j1.c
@@ -272,7 +272,7 @@ static const double ps2[5] = {
if(ix>=0x40200000) {p = pr8; q= ps8;}
else if(ix>=0x40122E8B){p = pr5; q= ps5;}
else if(ix>=0x4006DB6D){p = pr3; q= ps3;}
- else if(ix>=0x40000000){p = pr2; q= ps2;}
+ else {p = pr2; q= ps2;} /* ix>=0x40000000 */
z = one/(x*x);
r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
diff --git a/lib/msun/src/e_j1f.c b/lib/msun/src/e_j1f.c
index 88e2d83..3492edd 100644
--- a/lib/msun/src/e_j1f.c
+++ b/lib/msun/src/e_j1f.c
@@ -229,7 +229,7 @@ static const float ps2[5] = {
if(ix>=0x41000000) {p = pr8; q= ps8;}
else if(ix>=0x40f71c58){p = pr5; q= ps5;}
else if(ix>=0x4036db68){p = pr3; q= ps3;}
- else if(ix>=0x40000000){p = pr2; q= ps2;}
+ else {p = pr2; q= ps2;} /* ix>=0x40000000 */
z = one/(x*x);
r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
OpenPOWER on IntegriCloud