fix sscanf test: src must be a string
[libc-test.git] / src / regression / scanf-nullbyte-char.c
blob48c69307e935cbe975c025188c62d3cc1017b97c
1 // commit: ef5507867b59d19f21437970e87b5d0415c07b2e 2013-06-22
2 // scanf should not append null byte after scanning %c
3 #include <stdio.h>
4 #include "test.h"
6 int main(void)
8 char dst[] = { 'a', 'a' };
9 char src[] = { 'b', 'b', 0 };
11 if (sscanf(src, "%c", dst) != 1)
12 t_error("sscanf %%c failed\n");
13 if (dst[1] != 'a')
14 t_error("scanf clobbered the char buffer for %%c conversion\n");
15 return t_status;