summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-05-03 18:42:37 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-05-03 18:42:37 +0000
commit54b71e02837f199b5b1eafcbb3c19b7b81df5561 (patch)
tree94e092ce8bff5ca17ec70af3b699755c97303d5f /libio
parentd3dfcc4187a4e790d72ede37f8241a25adeb2483 (diff)
downloadglibc-54b71e02837f199b5b1eafcbb3c19b7b81df5561.tar.gz
glibc-54b71e02837f199b5b1eafcbb3c19b7b81df5561.tar.xz
glibc-54b71e02837f199b5b1eafcbb3c19b7b81df5561.zip
Fix conditions on checking versions of dprintf (bug 13775).
Diffstat (limited to 'libio')
-rw-r--r--libio/bits/stdio-ldbl.h6
-rw-r--r--libio/bits/stdio2.h46
2 files changed, 30 insertions, 22 deletions
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
index 3cc6ec416d..4ee043e42c 100644
--- a/libio/bits/stdio-ldbl.h
+++ b/libio/bits/stdio-ldbl.h
@@ -87,11 +87,13 @@ __LDBL_REDIR_DECL (__fprintf_chk)
 __LDBL_REDIR_DECL (__printf_chk)
 __LDBL_REDIR_DECL (__vfprintf_chk)
 __LDBL_REDIR_DECL (__vprintf_chk)
+#  ifdef __USE_XOPEN2K8
+__LDBL_REDIR_DECL (__dprintf_chk)
+__LDBL_REDIR_DECL (__vdprintf_chk)
+#  endif
 #  ifdef __USE_GNU
 __LDBL_REDIR_DECL (__asprintf_chk)
 __LDBL_REDIR_DECL (__vasprintf_chk)
-__LDBL_REDIR_DECL (__dprintf_chk)
-__LDBL_REDIR_DECL (__vdprintf_chk)
 __LDBL_REDIR_DECL (__obstack_printf_chk)
 __LDBL_REDIR_DECL (__obstack_vprintf_chk)
 #  endif
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index 2aca88d029..7383604b30 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -127,6 +127,32 @@ vfprintf (FILE *__restrict __stream,
   return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
 }
 
+# ifdef __USE_XOPEN2K8
+extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
+			  ...) __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __vdprintf_chk (int __fd, int __flag,
+			   const char *__restrict __fmt, _G_va_list __arg)
+     __attribute__ ((__format__ (__printf__, 3, 0)));
+
+#  ifdef __va_arg_pack
+__fortify_function int
+dprintf (int __fd, const char *__restrict __fmt, ...)
+{
+  return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt,
+			__va_arg_pack ());
+}
+#  elif !defined __cplusplus
+#   define dprintf(fd, ...) \
+  __dprintf_chk (fd, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
+#  endif
+
+__fortify_function int
+vdprintf (int __fd, const char *__restrict __fmt, _G_va_list __ap)
+{
+  return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
+}
+# endif
+
 # ifdef __USE_GNU
 
 extern int __asprintf_chk (char **__restrict __ptr, int __flag,
@@ -135,11 +161,6 @@ extern int __asprintf_chk (char **__restrict __ptr, int __flag,
 extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
 			    const char *__restrict __fmt, _G_va_list __arg)
      __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur;
-extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
-			  ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-extern int __vdprintf_chk (int __fd, int __flag,
-			   const char *__restrict __fmt, _G_va_list __arg)
-     __attribute__ ((__format__ (__printf__, 3, 0)));
 extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
 				 int __flag, const char *__restrict __format,
 				 ...)
@@ -167,13 +188,6 @@ __NTH (__asprintf (char **__restrict __ptr, const char *__restrict __fmt,
 }
 
 __fortify_function int
-dprintf (int __fd, const char *__restrict __fmt, ...)
-{
-  return __dprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt,
-			__va_arg_pack ());
-}
-
-__fortify_function int
 __NTH (obstack_printf (struct obstack *__restrict __obstack,
 		       const char *__restrict __fmt, ...))
 {
@@ -185,8 +199,6 @@ __NTH (obstack_printf (struct obstack *__restrict __obstack,
   __asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
 #   define __asprintf(ptr, ...) \
   __asprintf_chk (ptr, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
-#   define dprintf(fd, ...) \
-  __dprintf_chk (fd, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
 #   define obstack_printf(obstack, ...) \
   __obstack_printf_chk (obstack, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
 #  endif
@@ -199,12 +211,6 @@ __NTH (vasprintf (char **__restrict __ptr, const char *__restrict __fmt,
 }
 
 __fortify_function int
-vdprintf (int __fd, const char *__restrict __fmt, _G_va_list __ap)
-{
-  return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap);
-}
-
-__fortify_function int
 __NTH (obstack_vprintf (struct obstack *__restrict __obstack,
 			const char *__restrict __fmt, _G_va_list __ap))
 {