projects
/
libc-test
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
a5138aa
)
fix fwscanf test (don't use wide and byte io in the same FILE)
author
Szabolcs Nagy
<nsz@port70.net>
Sat, 20 Jul 2013 22:17:26 +0000
(22:17 +0000)
committer
Szabolcs Nagy
<nsz@port70.net>
Sat, 20 Jul 2013 22:17:26 +0000
(22:17 +0000)
src/functional/fwscanf.c
patch
|
blob
|
history
diff --git
a/src/functional/fwscanf.c
b/src/functional/fwscanf.c
index
3a96ae0
..
69a7bbf
100644
(file)
--- a/
src/functional/fwscanf.c
+++ b/
src/functional/fwscanf.c
@@
-17,12
+17,18
@@
static FILE *writetemp(const char *data)
{
FILE *f = tmpfile();
+ size_t n = strlen(data);
if (!f) return 0;
- if (!fwrite(data, strlen(data), 1, f)) {
+ if (write(fileno(f), data, n) != n) {
+ t_error("write: %s\n", strerror(errno));
+ fclose(f);
+ return 0;
+ }
+ if (lseek(fileno(f), 0, SEEK_SET) != 0) {
+ t_error("lseek: %s\n", strerror(errno));
fclose(f);
return 0;
}
- rewind(f);
return f;
}