aboutsummaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/printf_fphex.c4
-rw-r--r--stdio-common/test-popen.c15
-rw-r--r--stdio-common/vfscanf.c8
3 files changed, 25 insertions, 2 deletions
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
index c57396f98b..eaae77a8d5 100644
--- a/stdio-common/printf_fphex.c
+++ b/stdio-common/printf_fphex.c
@@ -166,7 +166,7 @@ __printf_fphex (FILE *fp,
if (__isinfl (fpnum.ldbl.d))
special = isupper (info->spec) ? "INF" : "inf";
- negative = fpnum.ldbl.d < 0;
+ negative = signbit (fpnum.ldbl.d);
}
}
else
@@ -184,7 +184,7 @@ __printf_fphex (FILE *fp,
if (__isinf (fpnum.dbl.d))
special = isupper (info->spec) ? "INF" : "inf";
- negative = fpnum.dbl.d < 0;
+ negative = signbit (fpnum.dbl.d);
}
}
diff --git a/stdio-common/test-popen.c b/stdio-common/test-popen.c
index 426da4a24c..b13a1c2542 100644
--- a/stdio-common/test-popen.c
+++ b/stdio-common/test-popen.c
@@ -82,6 +82,21 @@ main (void)
remove ("/tmp/tstpopen.tmp");
+ errno = 0;
+ output = popen ("/bin/cat", "m");
+ if (output != NULL)
+ {
+ puts ("popen called with illegal mode does not return NULL");
+ puts ("Test FAILED!");
+ exit (1);
+ }
+ if (errno != EINVAL)
+ {
+ puts ("popen called with illegal mode does not set errno to EINVAL");
+ puts ("Test FAILED!");
+ exit (1);
+ }
+
puts (wstatus | rstatus ? "Test FAILED!" : "Test succeeded.");
exit (wstatus | rstatus);
}
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index b9fc87679b..9f8eba9c4c 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -434,6 +434,13 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
flags |= LONGDBL;
break;
case 'a':
+ /* The `a' is used as a flag only if followed by `s', `S' or
+ `['. */
+ if (*f != 's' && *f != 'S' && *f != '[')
+ {
+ --f;
+ break;
+ }
if (flags & TYPEMOD)
/* Signal illegal format element. */
conv_error ();
@@ -917,6 +924,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
case 'f':
case 'g':
case 'G':
+ case 'a':
case 'A':
c = inchar ();
if (c == EOF)