diff options
author | Jakub Jelinek <jakub@redhat.com> | 2004-10-18 09:58:59 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2004-10-18 09:58:59 +0000 |
commit | 56c4396a6e1568a5511ac43873fa3c9e1ebfa8d1 (patch) | |
tree | f2d0f6e1aaf9794668b53c6456fcacbbacd63805 /stdio-common | |
parent | 4ce1a5c9712b4d7616058e708630c33744f983f6 (diff) | |
download | glibc-56c4396a6e1568a5511ac43873fa3c9e1ebfa8d1.tar.gz glibc-56c4396a6e1568a5511ac43873fa3c9e1ebfa8d1.tar.xz glibc-56c4396a6e1568a5511ac43873fa3c9e1ebfa8d1.zip |
Updated to fedora-glibc-20041018T0940
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/vfprintf.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 38da382efa..5e480ad52b 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -70,6 +70,7 @@ # define INT_T int # define L_(Str) Str # define ISDIGIT(Ch) ((unsigned int) ((Ch) - '0') < 10) +# define STR_LEN(Str) strlen (Str) # define PUT(F, S, N) _IO_sputn ((F), (S), (N)) # define PAD(Padchar) \ @@ -86,6 +87,7 @@ # define INT_T wint_t # define L_(Str) L##Str # define ISDIGIT(Ch) ((unsigned int) ((Ch) - L'0') < 10) +# define STR_LEN(Str) __wcslen (Str) # include "_itowa.h" @@ -219,6 +221,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) /* For the %m format we may need the current `errno' value. */ int save_errno = errno; + /* 1 if format is in read-only memory, -1 if it is in writable memory, + 0 if unknown. */ + int readonly_format = 0; /* This table maps a character into a number representing a class. In each step there is a destination label for each @@ -877,6 +882,19 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap) /* NOTREACHED */ \ \ LABEL (form_number): \ + if (s->_flags2 & _IO_FLAGS2_CHECK_PERCENT_N) \ + { \ + if (! readonly_format) \ + { \ + extern int __readonly_area (const void *, size_t) \ + attribute_hidden; \ + readonly_format \ + = __readonly_area (format, (STR_LEN (format) + 1) \ + * sizeof (CHAR_T)); \ + } \ + if (readonly_format < 0) \ + __chk_fail (); \ + } \ /* Answer the count of characters written. */ \ if (fspec == NULL) \ { \ @@ -2091,6 +2109,7 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format, #ifdef _IO_MTSAFE_IO hp->_lock = NULL; #endif + hp->_flags2 = s->_flags2; _IO_JUMPS (&helper._f) = (struct _IO_jump_t *) &_IO_helper_jumps; /* Now print to helper instead. */ |