I'm playing with fork in linux and i see something that don't like me
I read this link After forking, are global variables shared? and i did a test with gdb
[c0m0@worktux programming]$ ps aux | grep env
c0m0 3108 0.0 0.0 4288 324 pts/1 S 22:53 0:00 ./env
c0m0 3110 0.0 0.0 4288 80 pts/1 S 22:53 0:00 ./env
[c0m0@worktux programming]$ gdb -q -p 3108
Attaching to process 3108
(gdb) call getenv("toto")
$1 = 4195989
(gdb) x/s $1
0x400695: "root"
Now i'll attach to child process
[c0m0@worktux programming]$ gdb -q -p 3110
Attaching to process 3110
(gdb) call getenv("toto")
$1 = 4195989
(gdb) x/s $1
0x400695: "root"
So my what my question is, why i see the variable what i set into fork in the both process?
I used the function putenv for set toto=root, i try to be more clear.
Can i see a environment variable that was setting in the child process from the parent?