From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0D6B4385800A; Thu, 22 Sep 2022 14:51:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D6B4385800A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663858292; bh=yO12KyyYI9wFGQTplUAmf4LePnaxAvCdJ0JQYz/0nsQ=; h=From:To:Subject:Date:From; b=ia2K/U+qCYScVrlqTNuXac5MkEOIxx0ouwU5o1rQn/Pkvz+UFIOThQdkb5Rr9f8Lr lpdR6k8/ETnir4CYf1hpkOC87W+acqHpgF4gojabbs/gkmL+xziIRiHL3+4wuYJBXA Lniuri019XLtQgYPpbIvwbVPGZ50UFda/chN8TQQ= From: "abdulrahman.mahmoud75 at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug libc/29601] New: fclose() doesn't flush the output as it should be Date: Thu, 22 Sep 2022 14:51:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.28 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: abdulrahman.mahmoud75 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29601 Bug ID: 29601 Summary: fclose() doesn't flush the output as it should be Product: glibc Version: 2.28 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: abdulrahman.mahmoud75 at gmail dot com CC: drepper.fsp at gmail dot com Target Milestone: --- I have created a mini example to test the fgets() utility but when i run th= is example i don't see any output in the shell, below is my example: #include int main () { FILE *fp, *fd_3, *fd_2; char str[60]; char str1[] =3D "writing to file "; char str2[] =3D "my file"; fp =3D fopen("file/test_fopen" , "w"); fclose(fp); fd_3 =3D fopen("file/test_fopen" , "r"); fp =3D fopen("file/test_fopen" , "a"); fwrite(str1 , 1 , sizeof(str1) , fp); if( fgets (str, 60, fd_3)!=3DNULL ) { puts(str); } fclose(fp); fd_2 =3D fopen("file/test_fopen" , "a"); fwrite(str2 , 1 , sizeof(str2) , fd_2); if( fgets (str, 60, fd_3)!=3DNULL ) { puts(str); } fclose(fd_2); return(0); } When i compile and run this code against glibc-2.17 i receive an output "writing to file" on the shell but when i compile against glibc-2.28, there= is no output. So is this an expected behavior? is the way of flushing when calling fclose= () changed between the two versions? --=20 You are receiving this mail because: You are on the CC list for the bug.=