Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 May 1996 20:20:01 -0700
From:      Josh MacDonald <jmacd@CS.Berkeley.EDU>
To:        sclawson@bottles.cs.utah.edu (steve clawson)
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: stdio problem 
Message-ID:  <199605030320.UAA18744@paris.CS.Berkeley.EDU>
In-Reply-To: Your message of "Thu, 02 May 1996 20:02:27 MDT." <199605030202.UAA07379@bottles.cs.utah.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help

Whether I do fclose(stdin) or close(STDIN_FILENO) makes no difference,
and in fact the same problem applies.  I am execing another program
which then tries to freopen(...,...,stdin).

>      Perhaps the answers weren't very explanatory, but they were
> correct.  Basically, your program is at the very least non-portable,
> and IMHO buggy.  Calling close(0) is _not_ the proper way to `close'
> stdin.  This just closes file descriptior 0, but dosen't do anything
> to close the stream stdin, which has user-level state.  You should use
> fclose() to close it if you really need to.  close() isn't even in
> ANSI C.  

Whatever...  I'll just create a pipe(), close the writer, and dup
the reader.

-josh



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605030320.UAA18744>