SIGSEGV in socket ( ) - 10/11/2007, 16:25

I lost nearly two hours finding what caused this one..

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x8063000 (LWP 100187)]
0x08059a20 in socket ()

Cause: global variable named 'socket'. glibc or something else has a function named 'socket( )'. The program gets confused somehow.

Solution: rename 'socket' to something else. And STOP using global variables altogether!

Note: This seems to be fixed in recent gnu/linux distros, but it still exists in FreeBSD 6..,156834,156849#msg-156849,156834,157082#msg-157082

(By the way, my program had absolutely nothing to do with MySQL.)

< Back to blog

This site doesn't use cookies, does not log IPs and does not track you in any way.