Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 26 Sep 2014 14:05:57 +0800
From: 黄建忠 <jianzhong.huang@...oft.com.cn>
To: musl@...ts.openwall.com
Subject: fdopen/fflush problem

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



Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.