strange segmentation fault
I have been reading Unix Network Programming by Stevens, and have been doing the exercises along with it.
I have written a small, basic tcp server that is simply going to transfer small packets to and from a client. When I try to execute the program, after a successful compile, I immediatly get a SEGMENTATION FAULT and the program quits. I get the following in gdb (note, i am not an experienced GDB user and only know the very basics)
Code:
Starting program: /home/tarcuri/CProjects/tcpserv 8888
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x005b61fd in inet_aton () from /lib/tls/libc.so.6
Now I am not really sure what GDB is supposed to be doing here but I never even called inet_aton() in my program. I see that it is referencing some library but I dont see how this helps me. Ill post the code below.
EDIT: I don't even know how to go about deciphering this.
Code:
[tarcuri@intern1 CProjects]$ gcc -g tcpserv tcpserv.c
collect2: ld terminated with signal 11 [Segmentation fault]
tcpserv(.rodata+0x0): multiple definition of `_fp_hw'
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crt1.o(.rodata+0x0): first defined here
tcpserv(.data+0x4): In function `__data_start':
: multiple definition of `__dso_handle'
/usr/lib/gcc/i386-redhat-linux/3.4.3/crtbegin.o(.data+0x0): first defined here
tcpserv(.init+0x0): In function `_init':
: multiple definition of `_init'
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crti.o(.init+0x0): first defined here
tcpserv(.text+0x0): In function `_start':
: multiple definition of `_start'
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crt1.o(.text+0x0): first defined here
tcpserv(.fini+0x0): In function `_fini':
: multiple definition of `_fini'
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crti.o(.fini+0x0): first defined here
tcpserv(.got.plt+0x0): multiple definition of `_GLOBAL_OFFSET_TABLE_'
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crt1.o(.got.plt+0x0): first defined here
tcpserv(.rodata+0x4): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crt1.o(.rodata+0x4): first defined here
tcpserv(.data+0x0): In function `__data_start':
: multiple definition of `__data_start'
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crt1.o(.data+0x0): first defined here
/tmp/ccJhB0Jh.o(.text+0x0): In function `main':
/home/tarcuri/CProjects/tcpserv.c:16: multiple definition of `main'
tcpserv(.text+0xa8): first defined here
/tmp/ccJhB0Jh.o(.text+0x265): In function `sendData':
/home/tarcuri/CProjects/tcpserv.c:82: multiple definition of `sendData'
tcpserv(.text+0x30d): first defined here
/tmp/ccJhB0Jh.o(.text+0x383): In function `recvData':
/home/tarcuri/CProjects/tcpserv.c:110: multiple definition of `recvData'
tcpserv(.text+0x42b): first defined here
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../crt1.o(.dynamic+0x0): multiple definition of `_DYNAMIC'
tcpserv(.dynamic+0x0): first defined here