Merge "Take a bunch of trivial patches from upstream OpenBSD."
am: feb88ff424
Change-Id: I3ad9a0d8195b5a5987742fcb0f8a034ce7ed9631
This commit is contained in:
commit
1a16af79e5
24 changed files with 53 additions and 50 deletions
|
@ -3113,7 +3113,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
Copyright (c) 1997 Todd C. Miller <millert@openbsd.org>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
@ -3353,7 +3353,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -4560,7 +4560,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2007 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
Copyright (c) 2007 Todd C. Miller <millert@openbsd.org>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -4923,7 +4923,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
Copyright (c) 2010 Todd C. Miller <millert@openbsd.org>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#define _BSD_SOURCE
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <unistd.h> // For environ.
|
||||
|
||||
#include <stddef.h> // For size_t.
|
||||
|
||||
#include <sys/random.h> // For getentropy.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: arc4random_uniform.c,v 1.2 2015/09/13 08:31:47 guenther Exp $ */
|
||||
/* $OpenBSD: arc4random_uniform.c,v 1.3 2019/01/20 02:59:07 bcook Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008, Damien Miller <djm@openbsd.org>
|
||||
|
@ -16,7 +16,7 @@
|
|||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: alarm.c,v 1.8 2016/01/28 16:40:54 schwarze Exp $ */
|
||||
/* $OpenBSD: alarm.c,v 1.9 2019/06/28 13:32:41 deraadt Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
@ -40,7 +40,7 @@ alarm(unsigned int secs)
|
|||
timerclear(&itp->it_interval);
|
||||
itp->it_value.tv_sec = secs;
|
||||
itp->it_value.tv_usec = 0;
|
||||
if (setitimer(ITIMER_REAL, itp, &oitv) < 0)
|
||||
if (setitimer(ITIMER_REAL, itp, &oitv) == -1)
|
||||
return ((unsigned int) -1);
|
||||
if (oitv.it_value.tv_usec)
|
||||
oitv.it_value.tv_sec++;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Public domain, 2008, Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* Public domain, 2008, Todd C. Miller <millert@openbsd.org>
|
||||
*
|
||||
* $OpenBSD: charclass.h,v 1.1 2008/10/01 23:04:13 millert Exp $
|
||||
* $OpenBSD: charclass.h,v 1.2 2019/01/25 00:19:25 millert Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ftok.c,v 1.8 2014/11/15 22:38:47 guenther Exp $ */
|
||||
/* $OpenBSD: ftok.c,v 1.9 2019/06/28 13:32:41 deraadt Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
|
||||
* All rights reserved.
|
||||
|
@ -34,7 +34,7 @@ ftok(const char *path, int id)
|
|||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(path, &st) < 0)
|
||||
if (stat(path, &st) == -1)
|
||||
return (key_t)-1;
|
||||
|
||||
return (key_t)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: setprogname.c,v 1.5 2016/03/13 18:34:20 guenther Exp $ */
|
||||
/* $OpenBSD: setprogname.c,v 1.6 2017/09/17 06:38:03 otto Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2013 Antoine Jacoutot <ajacoutot@openbsd.org>
|
||||
*
|
||||
|
@ -21,11 +21,11 @@
|
|||
void
|
||||
setprogname(const char *progname)
|
||||
{
|
||||
const char *tmpn;
|
||||
char *tmpn;
|
||||
|
||||
tmpn = strrchr(progname, '/');
|
||||
if (tmpn == NULL)
|
||||
__progname = progname;
|
||||
__progname = (char *)progname;
|
||||
else
|
||||
__progname = tmpn + 1;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* $OpenBSD: wcsxfrm.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */
|
||||
/* $OpenBSD: wcsxfrm.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */
|
||||
/* $NetBSD: multibyte_sb.c,v 1.4 2003/08/07 16:43:04 agc Exp $ */
|
||||
/* $OpenBSD: wcsxfrm.c,v 1.3 2017/09/05 03:16:13 schwarze Exp $ */
|
||||
/* $NetBSD: multibyte_sb.c,v 1.4 2003/08/07 16:43:04 agc Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
|
@ -40,3 +39,4 @@ wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n)
|
|||
return wcslen(src);
|
||||
return wcslcpy(dest, src, n);
|
||||
}
|
||||
DEF_STRONG(wcsxfrm);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: makebuf.c,v 1.9 2015/01/13 07:18:21 guenther Exp $ */
|
||||
/* $OpenBSD: makebuf.c,v 1.10 2019/06/28 13:32:42 deraadt Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
@ -81,7 +81,7 @@ __swhatbuf(FILE *fp, size_t *bufsize, int *couldbetty)
|
|||
{
|
||||
struct stat st;
|
||||
|
||||
if (fp->_file < 0 || fstat(fp->_file, &st) < 0) {
|
||||
if (fp->_file < 0 || fstat(fp->_file, &st) == -1) {
|
||||
*couldbetty = 0;
|
||||
*bufsize = BUFSIZ;
|
||||
return (__SNPT);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: mktemp.c,v 1.38 2015/09/13 08:31:47 guenther Exp $ */
|
||||
/* $OpenBSD: mktemp.c,v 1.39 2017/11/28 06:55:49 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1996-1998, 2008 Theo de Raadt
|
||||
* Copyright (c) 1997, 2008-2009 Todd C. Miller
|
||||
|
@ -119,7 +119,7 @@ _mktemp(char *path)
|
|||
}
|
||||
|
||||
__warn_references(mktemp,
|
||||
"warning: mktemp() possibly used unsafely; consider using mkstemp()");
|
||||
"mktemp() possibly used unsafely; consider using mkstemp()");
|
||||
|
||||
char *
|
||||
mktemp(char *path)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tempnam.c,v 1.19 2015/08/31 02:53:57 guenther Exp $ */
|
||||
/* $OpenBSD: tempnam.c,v 1.20 2017/11/28 06:55:49 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
__warn_references(tempnam,
|
||||
"warning: tempnam() possibly used unsafely; consider using mkstemp()");
|
||||
"tempnam() possibly used unsafely; consider using mkstemp()");
|
||||
|
||||
char *
|
||||
tempnam(const char *dir, const char *pfx)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: tmpnam.c,v 1.11 2015/08/31 02:53:57 guenther Exp $ */
|
||||
/* $OpenBSD: tmpnam.c,v 1.12 2017/11/28 06:55:49 tb Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
__warn_references(tmpnam,
|
||||
"warning: tmpnam() possibly used unsafely; consider using mkstemp()");
|
||||
"tmpnam() possibly used unsafely; consider using mkstemp()");
|
||||
|
||||
char *
|
||||
tmpnam(char *s)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* $OpenBSD: vswprintf.c,v 1.6 2015/08/31 02:53:57 guenther Exp $ */
|
||||
/* $OpenBSD: vswprintf.c,v 1.7 2019/01/25 00:19:25 millert Exp $ */
|
||||
/* $NetBSD: vswprintf.c,v 1.1 2005/05/14 23:51:02 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* Copyright (c) 1997 Todd C. Miller <millert@openbsd.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: getenv.c,v 1.10 2010/08/23 22:31:50 millert Exp $ */
|
||||
/* $OpenBSD: getenv.c,v 1.12 2016/03/13 18:34:21 guenther Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
@ -31,7 +31,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
char *__findenv(const char *name, int len, int *offset);
|
||||
|
||||
/*
|
||||
* __findenv --
|
||||
|
@ -46,7 +45,6 @@ char *__findenv(const char *name, int len, int *offset);
|
|||
char *
|
||||
__findenv(const char *name, int len, int *offset)
|
||||
{
|
||||
extern char **environ;
|
||||
int i;
|
||||
const char *np;
|
||||
char **p, *cp;
|
||||
|
@ -79,3 +77,4 @@ getenv(const char *name)
|
|||
;
|
||||
return (__findenv(name, (int)(np - name), &offset));
|
||||
}
|
||||
DEF_STRONG(getenv);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: llabs.c,v 1.3 2007/01/08 19:39:25 deraadt Exp $ */
|
||||
/* $OpenBSD: llabs.c,v 1.4 2016/08/14 23:18:03 guenther Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
|
@ -36,3 +36,5 @@ llabs(long long j)
|
|||
{
|
||||
return (j < 0 ? -j : j);
|
||||
}
|
||||
|
||||
__weak_alias(qabs, llabs);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD: memrchr.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */
|
||||
/* $OpenBSD: memrchr.c,v 1.4 2019/01/25 00:19:25 millert Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* Copyright (c) 2007 Todd C. Miller <millert@openbsd.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: stpcpy.c,v 1.2 2014/07/09 17:08:21 naddy Exp $ */
|
||||
/* $OpenBSD: stpcpy.c,v 1.3 2017/11/28 06:55:49 tb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 Regents of the University of California.
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
#if defined(APIWARN)
|
||||
__warn_references(stpcpy,
|
||||
"warning: stpcpy() is dangerous; do not use it");
|
||||
"stpcpy() is dangerous; do not use it");
|
||||
#endif
|
||||
|
||||
char *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: strcat.c,v 1.9 2014/06/10 04:17:37 deraadt Exp $ */
|
||||
/* $OpenBSD: strcat.c,v 1.10 2017/11/28 06:55:49 tb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 Regents of the University of California.
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
#if defined(APIWARN)
|
||||
__warn_references(strcat,
|
||||
"warning: strcat() is almost always misused, please use strlcat()");
|
||||
"strcat() is almost always misused, please use strlcat()");
|
||||
#endif
|
||||
|
||||
char *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: strcpy.c,v 1.9 2014/06/10 04:17:37 deraadt Exp $ */
|
||||
/* $OpenBSD: strcpy.c,v 1.10 2017/11/28 06:55:49 tb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 Regents of the University of California.
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
#if defined(APIWARN)
|
||||
__warn_references(strcpy,
|
||||
"warning: strcpy() is almost always misused, please use strlcpy()");
|
||||
"strcpy() is almost always misused, please use strlcpy()");
|
||||
#endif
|
||||
|
||||
char *
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD: strlcat.c,v 1.18 2016/10/16 17:37:39 dtucker Exp $ */
|
||||
/* $OpenBSD: strlcat.c,v 1.19 2019/01/25 00:19:25 millert Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD: strlcpy.c,v 1.15 2016/10/16 17:37:39 dtucker Exp $ */
|
||||
/* $OpenBSD: strlcpy.c,v 1.16 2019/01/25 00:19:25 millert Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD: strndup.c,v 1.2 2015/08/31 02:53:57 guenther Exp $ */
|
||||
/* $OpenBSD: strndup.c,v 1.3 2019/01/25 00:19:25 millert Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* Copyright (c) 2010 Todd C. Miller <millert@openbsd.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD: wcslcpy.c,v 1.7 2015/09/12 16:23:14 guenther Exp $ */
|
||||
/* $OpenBSD: wcslcpy.c,v 1.8 2019/01/25 00:19:25 millert Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* Copyright (c) 1998, 2015 Todd C. Miller <millert@openbsd.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: wcsftime.c,v 1.6 2015/02/09 14:52:28 tedu Exp $ */
|
||||
/* $OpenBSD: wcsftime.c,v 1.7 2019/05/12 12:49:52 schwarze Exp $ */
|
||||
/*
|
||||
** Based on the UCB version with the ID appearing below.
|
||||
** This is ANSIish only when "multibyte character == plain character".
|
||||
|
@ -439,7 +439,7 @@ label:
|
|||
continue;
|
||||
case 'Z':
|
||||
if (t->tm_zone != NULL)
|
||||
pt = _sadd(t->TM_ZONE, pt, ptlim);
|
||||
pt = _sadd(t->tm_zone, pt, ptlim);
|
||||
else
|
||||
if (t->tm_isdst >= 0)
|
||||
pt = _sadd(tzname[t->tm_isdst != 0],
|
||||
|
|
Loading…
Reference in a new issue