On 3/8/11 10:10 AM, Dr. Werner Fink wrote:
> On Tue, Mar 08, 2011 at 03:07:13PM +0100, Roman Rakus wrote:
>> On 03/08/2011 12:32 PM, Dr. Werner Fink wrote:
>>> Something like the attached patch.
>>>
>> Seems it doesn't work. I have applied your patch, run that bash in
>> gnome-terminal, close the terminal. In gdb I set a break to atexit()
>> and maybe_save_shell_history() functions. Bash receives SIGHUP, I say
>> continue, bash again receives SIGHUP, again continue and bash ends.
>> gdb is saying: Program terminated with signal SIGHUP, Hangup.
>>
>> In man page of atexit:
>> NOTES
>>        Functions registered using atexit() (and on_exit(3)) are not
>> called  if
>>        a process terminates abnormally because of the delivery of a signal.
>>
>> so I guess it won't work.
> 
> I'm aware of this ... but here is what I see:

atexit(3) is not guaranteed to work that way portably.  Its behavior is
portable and standardized only for "normal program termination."

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to