lkml.org 
[lkml]   [1998]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: fork() memory corruption... is this glibc2 or kernel?

On Sat, 20 Jun 1998 tbittih@pal.xgw.fi wrote:

> While coding some network apps I noticed that fork() seemed to corrupt
> memory... so I ripped 95% of the program out and changed some things so
> that the bug hit the "critical" memory area around 10x more frequently...

the subtle issue here is that you are using libc6's fgets(), which uses
mmap(), which is not copied on fork() ... this way you might see the
changes done in a child/parent process.

(also, you check for erroneous fork()s in a broken way, fork returns -1 on
error, not 0.)

-- mingo


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:43    [from the cache]
©2003-2011 Jasper Spaans