Menu

#178 Invalid signal handling

0.65.x
closed-out-of-date
nobody
Behaviour (212)
5
2004-09-03
2003-10-30
No

Please fix src/BaseDisplay.cc:

BaseDisplay::BaseDisplay():
- Don't connect any signal handlers to SIGFPE or
SIGSEGV - unless
you have very good reasons to to so.

signalhandler():
- You MUST NOT use fprintf() in any signalhandler!
- You MUST NOT use exit() in any signalhandler either,
use _exit().
- base_display->handleSignal() is a pure virtual
method but the instance
base_display hasn't been completely initialised yet
in all cases because
the signalhandler is connected from the constructor
of the object.
- You might want to apply the signalhandler to SIGQUIT
as well.

Discussion

  • Bradley T. Hughes

    • status: open --> closed-out-of-date
     
  • Bradley T. Hughes

    Logged In: YES
    user_id=459209

    the code in question has been rewritten propertly in CVS

     
  • Christian Biere

    Christian Biere - 2004-09-03

    Logged In: YES
    user_id=643728

    This one still stands:

    signalhandler():
    - You MUST NOT use fprintf() in any signalhandler!

    You can use write(STDERR_FILENO, ...) instead.

     
  • Bradley T. Hughes

    Logged In: YES
    user_id=459209

    wrong, the signal handler in CVS (lib/Application.cc) does
    not do anything but set a single bit in a sig_atomic_t. :)

     
  • Christian Biere

    Christian Biere - 2004-09-06

    Logged In: YES
    user_id=643728

    Ok, as usual the SF's public CVS was way behind the
    developer's CVS so I couldn't see those changes. Still, this
    is not absolutely clean. sig_atomic_t is not necessarily
    a 32-bit integer (could be a single byte) and many platforms
    have even more than 32 signals (e.g., Solaris 8 has 34
    signal types but SIG_ATOMIC_MAX is (1<<32) - 1. Well, I
    *guess* the signal numbers are actually portable and below
    32 but there's no such guarantee or standard. It would be
    better to use one variable per signal you want to catch.

    http://www.opengroup.org/onlinepubs/009695399/basedefs/stdint.h.html

     

Log in to post a comment.