[lkml]   [1996]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectNULL strings cause "segmenation fault"
Hi I'm not sure if this is the correct place to ask this question but I'm 
getting a "segmentation fault" when I perform some string operations. In
fact I've isolated the code to the following:

char *s ;
char *t ;
if (strcmp(s, t) == 0)

It seems that if s or t are NULL pointers (as they are when first
allocated) then I get the fault. According to the MAN page on strcmp, if
s or t are NULL then they are treated as if they point to NULL-terminated
string. So I shouldn't have to check for this in my program.

I've seen the same problem on the "getenv" function as well.

I tried updating the compiler from GCC 2.6.3 to 2.7.2 - no help. I tried
updating the kernel from 1.2.3 to 1.2.13 - no help. I think its in a LIB
file somewhere but not sure which one or how to correct it if it is a LIB

If anyone has experienced this I'd like to know the history on it. Thanks
in advance for any help.

* Gary Isliefson * Lockheed Martin *
* Design Engineer * Electronics Canada Inc. *
* Ph. (204) 253-3173 * Winnipeg, Manitoba, Cda *
* Fax (204) 253-3101 * 101-51 Burmac Rd *
* Email Address: * R2J 4C9 *
* * *

 \ /
  Last update: 2005-03-22 13:38    [W:0.028 / U:3.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site