inet_ntoa and segmentation fault

inet_ntoa and segmentation fault

Oron Peled oron at actcom.co.il
Wed Jul 15 22:52:18 IDT 2009


On 15.07.2009 Shachar Shemesh wrote:
> The problem:
> The following code segfaults:
>     printf("%s\n", inet_ntoa(addr) );
> 
> The cause: Failing to include the relevant header file.
> 
> The solution: Add:
> #include <arpa/inet.h>

Easier to catch during compile time: CFLAGS='-Wall -Werror'
This would fail the build because of missing prototypes.

-- 
Oron Peled                                 Voice: +972-4-8228492
oron at actcom.co.il                  http://users.actcom.co.il/~oron
Linux lasts longer!
                        -- "Kim J. Brand" <kim at kimbrand.com>




More information about the Linux-il mailing list