Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc undo SSP damage from -Wsystem-headers



details:   https://anonhg.NetBSD.org/src/rev/675595b2506a
branches:  trunk
changeset: 820622:675595b2506a
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jan 12 18:16:52 2017 +0000

description:
undo SSP damage from -Wsystem-headers

diffstat:

 lib/libc/gen/syslog.c        |   8 ++------
 lib/libc/include/namespace.h |   7 ++++---
 lib/libc/stdio/vsnprintf.c   |  18 +++++++++++-------
 3 files changed, 17 insertions(+), 16 deletions(-)

diffs (104 lines):

diff -r 3f380d268299 -r 675595b2506a lib/libc/gen/syslog.c
--- a/lib/libc/gen/syslog.c     Thu Jan 12 17:38:08 2017 +0000
+++ b/lib/libc/gen/syslog.c     Thu Jan 12 18:16:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syslog.c,v 1.57 2017/01/12 01:58:39 christos Exp $     */
+/*     $NetBSD: syslog.c,v 1.58 2017/01/12 18:16:52 christos Exp $     */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)syslog.c   8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: syslog.c,v 1.57 2017/01/12 01:58:39 christos Exp $");
+__RCSID("$NetBSD: syslog.c,v 1.58 2017/01/12 18:16:52 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -133,11 +133,7 @@
 static struct syslog_fun _syslog_fun = {
        timefun,
        strerror_r,
-#ifndef __lint__
-       _vsnprintf,
-#else
        vsnprintf,
-#endif
        lock,
        unlock,
 };
diff -r 3f380d268299 -r 675595b2506a lib/libc/include/namespace.h
--- a/lib/libc/include/namespace.h      Thu Jan 12 17:38:08 2017 +0000
+++ b/lib/libc/include/namespace.h      Thu Jan 12 18:16:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namespace.h,v 1.183 2017/01/12 00:35:38 christos Exp $ */
+/*     $NetBSD: namespace.h,v 1.184 2017/01/12 18:16:52 christos Exp $ */
 
 /*-
  * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@@ -30,6 +30,7 @@
 #define _NAMESPACE_H_
 
 #include <sys/cdefs.h>
+#include <ssp/ssp.h>
 
 #ifndef __lint__
 #define aio_suspend    _aio_suspend
@@ -625,7 +626,7 @@
 #define sl_free                        _sl_free
 #define sl_init                        _sl_init
 #define sleep                  _sleep
-#ifndef snprintf
+#if __SSP_FORTIFY_LEVEL == 0
 #define snprintf               _snprintf
 #endif
 #define snprintf_l             _snprintf_l
@@ -735,7 +736,7 @@
 #define vasprintf              _vasprintf
 #define vasprintf_l            _vasprintf_l
 #define        vdprintf                _vdprintf
-#ifndef vsnprintf
+#if __SSP_FORTIFY_LEVEL == 0
 #define vsnprintf              _vsnprintf
 #endif
 #define vdprintf_l             _vdprintf_l
diff -r 3f380d268299 -r 675595b2506a lib/libc/stdio/vsnprintf.c
--- a/lib/libc/stdio/vsnprintf.c        Thu Jan 12 17:38:08 2017 +0000
+++ b/lib/libc/stdio/vsnprintf.c        Thu Jan 12 18:16:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vsnprintf.c,v 1.28 2014/09/29 14:58:33 christos Exp $  */
+/*     $NetBSD: vsnprintf.c,v 1.29 2017/01/12 18:16:52 christos Exp $  */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)vsnprintf.c        8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: vsnprintf.c,v 1.28 2014/09/29 14:58:33 christos Exp $");
+__RCSID("$NetBSD: vsnprintf.c,v 1.29 2017/01/12 18:16:52 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -51,11 +51,15 @@
 #include "setlocale_local.h"
 #include "local.h"
 
-#if defined(_FORTIFY_SOURCE) && !defined(__lint__)
-#undef vsnprintf
-#define vsnprintf _vsnprintf
-#undef snprintf
-#define snprintf _snprintf
+#if __SSP_FORTIFY_LEVEL != 0
+# undef vsnprintf
+# define vsnprintf _vsnprintf
+# undef snprintf
+# define snprintf _snprintf
+int      snprintf(char * __restrict, size_t, const char * __restrict, ...)
+    __printflike(3, 4);
+int      vsnprintf(char * __restrict, size_t, const char * __restrict,
+    __va_list) __printflike(3, 0);
 #endif
 
 #ifdef __weak_alias



Home | Main Index | Thread Index | Old Index