-/* Copyright (C) 1991, 1995, 1997, 1998, 2004, 2006, 2008
- Free Software Foundation, Inc.
+/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
-#include <libioP.h>
#include <stdarg.h>
-#include <stdio.h>
+#include <libio/libioP.h>
/* Write formatted output to D, according to the format string FORMAT. */
int
-__dprintf_chk (int d, int flags, const char *format, ...)
+__dprintf_chk (int d, int flag, const char *format, ...)
{
- va_list arg;
- int done;
+ /* For flag > 0 (i.e. __USE_FORTIFY_LEVEL > 1) request that %n
+ can only come from read-only format strings. */
+ unsigned int mode = (flag > 0) ? PRINTF_FORTIFY : 0;
+ va_list ap;
+ int ret;
- va_start (arg, format);
- done = __vdprintf_chk (d, flags, format, arg);
- va_end (arg);
+ va_start (ap, format);
+ ret = __vdprintf_internal (d, format, ap, mode);
+ va_end (ap);
- return done;
+ return ret;
}