|
-
August 2nd, 2008, 09:11 AM
#1
why crash?
1: string hist = getenv("HISTFILE");
2: if (hist != "/dev/null")
3: return -1;
the program crashes at 1
# Caught: basic_string::_S_construct NULL not valid
# Type: St11logic_error
it makes no sense since HISTFILE is not null
# echo $HISTFILE
/root/.bash_history
anyway i tried
1: char * hist = getenv("HISTFILE");
and
1: const char * hist = getenv("HISTFILE");
2: if (strcmp(hist,"/dev/null") != 0)
3: return -1;
and i get seg fault
it guess i get seg fault because the value of the variable is again null and i can't compare null with something... but why is it null instead or /root/.bash_history ? o.O
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|