about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-07-30 06:00:43 +0000
committerUlrich Drepper <drepper@redhat.com>2005-07-30 06:00:43 +0000
commit29c21e490099c35fb3e35c2c493b6b480b211e72 (patch)
tree7dc69b6d2492e181c548e5b6714bb9bb62a2119e /sysdeps/generic
parent155c581323f45dd7657ff011be1590a5ffdc4fa0 (diff)
downloadglibc-29c21e490099c35fb3e35c2c493b6b480b211e72.tar.gz
glibc-29c21e490099c35fb3e35c2c493b6b480b211e72.tar.xz
glibc-29c21e490099c35fb3e35c2c493b6b480b211e72.zip
* misc/bits/syslog.h: New file.
	* misc/sys/syslog.h: Include <bits/syslog.h> for fortification.
	* misc/Makefile (headers): Add bits/syslog.h.
	* include/sys/syslog.h: Add __vsyslog_chk prototype and hidden_proto.
	* sysdeps/generic/syslog.c: Change vsyslog function to __vsyslog_chk.
	Call __vfprintf_chk if necessary.  Make vsyslog a wrapper.  Add
	__syslog_chk.
	* misc/Versions: Export __syslog_chk and __vsyslog_chk.

	* nis/nis_xdr.c: Help gcc to avoid generating unnecessary wrapper
	functions.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/syslog.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/sysdeps/generic/syslog.c b/sysdeps/generic/syslog.c
index 9c8f422aad..9c5597f5aa 100644
--- a/sysdeps/generic/syslog.c
+++ b/sysdeps/generic/syslog.c
@@ -108,32 +108,28 @@ cancel_handler (void *ptr)
  *	print message on log file; output is intended for syslogd(8).
  */
 void
-#if __STDC__
 syslog(int pri, const char *fmt, ...)
-#else
-syslog(pri, fmt, va_alist)
-	int pri;
-	char *fmt;
-	va_dcl
-#endif
 {
 	va_list ap;
 
-#if __STDC__
 	va_start(ap, fmt);
-#else
-	va_start(ap);
-#endif
-	vsyslog(pri, fmt, ap);
+	__vsyslog_chk(pri, -1, fmt, ap);
 	va_end(ap);
 }
 libc_hidden_def (syslog)
 
 void
-vsyslog(pri, fmt, ap)
-	int pri;
-	register const char *fmt;
+__syslog_chk(int pri, int flag, const char *fmt, ...)
+{
 	va_list ap;
+
+	va_start(ap, fmt);
+	__vsyslog_chk(pri, flag, fmt, ap);
+	va_end(ap);
+}
+
+void
+__vsyslog_chk(int pri, int flag, const char *fmt, va_list ap)
 {
 	struct tm now_tm;
 	time_t now;
@@ -218,7 +214,10 @@ vsyslog(pri, fmt, ap)
 
 	    /* We have the header.  Print the user's format into the
                buffer.  */
-	    vfprintf (f, fmt, ap);
+	    if (flag == -1)
+	      vfprintf (f, fmt, ap);
+	    else
+	      __vfprintf_chk (f, flag, fmt, ap);
 
 	    /* Close the memory stream; this will finalize the data
 	       into a malloc'd buffer in BUF.  */
@@ -315,6 +314,16 @@ vsyslog(pri, fmt, ap)
 	if (buf != failbuf)
 		free (buf);
 }
+libc_hidden_def (__vsyslog_chk)
+
+void
+vsyslog(pri, fmt, ap)
+	int pri;
+	register const char *fmt;
+	va_list ap;
+{
+  __vsyslog_chk (pri, -1, fmt, ap);
+}
 libc_hidden_def (vsyslog)
 
 static struct sockaddr SyslogAddr;	/* AF_UNIX address of local logger */