[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fcloseall does not seem to work (fwd)

From: Aaron Wegner
Subject: fcloseall does not seem to work (fwd)
Date: Mon, 17 Nov 2003 09:31:30 -0600 (CST)

I was wondering if you could help me with a problem with the functionality
of fcloseall.  The following test program behaves differently for fclose
and fcloseall.  The fcloseall function behaves as expected on other
systems (Windows, Watcom).  With glibc, it seems to not unlink the

The program is attached, and shown in text below.


#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>

int main( int argc, char *argv[] )
   const char *filename = "junkfile.txt";
   FILE *fp;

   if(( fp = fopen( filename, "w+" )) == NULL ) {
      printf( "Can't open result file.\n" );
      return 1;

   fclose( fp );
   fclose( stdout );
   fclose( stderr );
   fclose( stdin );

   fputs( "This should not be written to the file.\n", fp );
   fprintf( stdout, "This should not be printed on the standard output
stream.\n" );
   fprintf( stderr, "This should not be printed on the standard error
stream.\n" );
   fgetc( stdin ); /* This should not block for input. */

   return 0;


>Submitter-Id:  net
>Originator:    aaronwegner
 <organization of PR author (multiple lines)>
>Confidential:  no
>Synopsis:      <synopsis of the problem (one line)>
>Severity:      <[ non-critical | serious | critical ] (one line)>
>Priority:      <[ low | medium | high ] (one line)>
>Category:      libc
>Class:         <[ sw-bug | doc-bug | change-request | support ] (one
>Release:       libc-2.2.93
        <machine, os, target, libraries (multiple lines)>
Host type: i386-redhat-linux-gnu
System: Linux localhost.localdomain 2.5.72 #37 Wed Nov 12 15:52:42 CST
2003 i686 athlon i386 GNU/Linux
Architecture: i686

Addons: c_stubs glibc-compat linuxthreads
Build CFLAGS: -march=i386 -freorder-blocks -DNDEBUG=1 -g -O3
Build CC: gcc
Compiler version: 3.2.3
Kernel headers: 2.5.72
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no

        <precise description of the problem (multiple lines)>
        <code/input/activities to reproduce the problem (multiple lines)>
        <how to correct or work around the problem, if known (multiple

Attachment: tst-fcloseall.c
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]