Bug 57159 - a error has been occured using fork() function while the relust is output though pipe.
a error has been occured using fork() function while the relust is output tho...
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-12-06 00:11 EST by Need Real Name
Modified: 2007-04-18 12:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-12-06 00:19:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
source code and result of test (3.02 KB, patch)
2001-12-06 00:19 EST, Need Real Name
no flags Details | Diff

  None (edit)
Description Need Real Name 2001-12-06 00:11:54 EST
Description of Problem:
   using fork() function to create chile process;the result of #./foo is 
different from #./foo >foo1.c

Version-Release number of selected component (if applicable):


How Reproducible:
It is so easy a C programe,compile and run the source code .that's all.


Steps to Reproduce:
1. #gcc -g -o foo foo.c
2. #./foo
3. #./foo >foo1.c

Actual Results:
Two  results is so much different.

Expected Results:
Two results are  no difference.

Additional Information:
	the source code ,the two relusts with email .
Comment 1 Need Real Name 2001-12-06 00:19:35 EST
Created attachment 39828 [details]
source code and result of test
Comment 2 Jakub Jelinek 2001-12-06 04:28:07 EST
Note more appropriate forum for this would be some unix basics news forum,
not a bug report.

Essentially what happens is that you use a buffered stdio without flushing,
so you really cannot wonder that if its output was only buffered not printed
before fork, that the buffered output will be flushed both in the parent
and in the child. E.g. fflush(stdout); before the fork() calls could do the
trick.

Note You need to log in before you can comment on or make changes to this bug.