![]() |
segfault using sigaction with gnu history
i am writing a shell program with a history feature. i am reassigning sigint (ctrl-c) to print the history list. i am trying to use the gnu history library to manage the history, but it now segfaults on ctrl-c. here is the code:
setup signal handler; :
struct sigaction handler;:
void handle_SIGINT(int signo):
add_history(*args);any help would be appreciated, if more info is needed, let me know. |
Well, if the problem goes away when you comment out a call to add_history(), a fairly strong possibility is that the call of add_history() is the cause of the problem ...... which would mean the problem has nothing to the signal handling (the signal handling works incorrectly as a side-effect of an error by add_history()).
You haven't really provided enough information, but my guess is that add_history() assumes something about "args" that you are not honouring in main(). |
thanks for the response.. i tracked down the problem...
the add_history function did not work well with the *args pointer.. it would complile and execute once fine, but segfault.. fixed by assigning *args contents to buffer var and passing this in to add_history. |
| All times are GMT -5. The time now is 5:13 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC