mailing list of musl libc
 help / color / mirror / code / Atom feed
* fdopen/fflush problem
@ 2014-09-26  6:05 黄建忠
  2014-09-26  6:18 ` Rich Felker
  2014-09-26  6:37 ` Szabolcs Nagy
  0 siblings, 2 replies; 9+ messages in thread
From: 黄建忠 @ 2014-09-26  6:05 UTC (permalink / raw)
  To: musl

Hi, there,
I encounter a problem about fdopen and fflush with musl, here is the code:

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>

int main()
{
char filename[17] = "/tmp/abcdeXXXXXX";
int fd = mkostemp(filename, O_WRONLY|O_CLOEXEC);
printf("filename: %s\n", filename);
if(fd < 0)
printf("fd error\n");

FILE *f = fdopen(fd, "we");
fputs("test string\n", f);
fflush(f);

if(ferror(f))
printf("file error\n");

fclose(f);
}

As expected, the final file should contains one line and no ferror reported.

Anybody can help to check it?

By the way, I did not subscribe to this mail list with this mail box,
please CC to jianzhong.huang AT i-soft.com.cn

-- 
Huang JianZhong





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-09-27 16:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26  6:05 fdopen/fflush problem 黄建忠
2014-09-26  6:18 ` Rich Felker
2014-09-26  6:39   ` Szabolcs Nagy
2014-09-26  7:05     ` Rich Felker
2014-09-26  7:23       ` u-wsnj
2014-09-27 13:29         ` Anthony G. Basile
2014-09-27 13:38           ` Rich Felker
2014-09-27 16:56             ` Anthony G. Basile
2014-09-26  6:37 ` Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).