Subject: ELDK glibc fcntl(socketFd,F_SETFL, flags) causes Seg Fault

From: Daniel Ng <[email-masked]>
Date: Thu, 1 Feb 2007 06:56:43 +0000 (UTC)

Hi,

My application Seg Faults when I try to set flags for my socket fd.

First, I get the fd by calling socket():
fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);

Then I try getting the fd flags:
fcntl(fd, F_GETFL, flags)

Then I try setting the flags:
flags |= O_NONBLOCK;
fcntl( fd, F_SETFL, flags );

-I get consistent Seg Faults on the last line above.

-I also checked fd, which is a sensible value. 
I can even successfully connect() with it.

-The problem happens regardless of what value 'flags' is set to

My embedded target details-

-powerpc8272
-ELDK v4
-the application uses glibc

Any ideas why I'm getting these Seg Faults?

Cheers,
Daniel