public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "abdulrahman.mahmoud75 at gmail dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-29601-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29601

            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 this
example i don't see any output in the shell, below is my example:

#include <stdio.h>

int main () {
   FILE *fp, *fd_3, *fd_2;
   char str[60];
   char str1[] = "writing to file ";
   char str2[] = "my file";

   fp = fopen("file/test_fopen" , "w");
   fclose(fp);
   fd_3 = fopen("file/test_fopen" , "r");
   fp = fopen("file/test_fopen" , "a");
   fwrite(str1 , 1 , sizeof(str1) , fp);
   if( fgets (str, 60, fd_3)!=NULL ) {
      puts(str);
   }
   fclose(fp);
   fd_2 = fopen("file/test_fopen" , "a");
   fwrite(str2 , 1 , sizeof(str2) , fd_2);
   if( fgets (str, 60, fd_3)!=NULL ) {
      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?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-09-22 14:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 14:51 abdulrahman.mahmoud75 at gmail dot com [this message]
2022-09-22 16:05 ` [Bug libc/29601] " schwab@linux-m68k.org
2022-09-22 18:01 ` abdulrahman.mahmoud75 at gmail dot com
2022-09-23  5:25 ` [Bug stdio/29601] " fweimer at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29601-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).