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

On Sat, 20 Jun 1998 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

 \ /
  Last update: 2005-03-22 13:43    [W:0.101 / U:3.876 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site