bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texinfo-4.3d: signal handling improper under Irix (non-portable code)


From: ezra peisach
Subject: texinfo-4.3d: signal handling improper under Irix (non-portable code)
Date: Tue, 28 Jan 2003 13:09:18 -0500 (EST)

Texinfo would not compile with the native C compiler.

There is an assumption in info/signals.c as to the layout of struct sigaction
which is non-portable.

Under Irix, a struct sigaction is defined as:

typedef union __sighandler {
        __sigret_t (*sa_handler1)(__sigargs); /* SIG_DFL, SIG_IGN, or *fn */
#if _POSIX93 || _XOPEN4UX
        void (*sa_sigaction1)(int, siginfo_t *, void *);
#endif
} __sighandler_t;
#if _SGIAPI
#define __sa_handler    sa_handler1
#define __sa_sigaction  sa_sigaction1
#endif
typedef struct sigaction {
        int sa_flags;                   /* see below for values         */
        __sighandler_t sa_sighandler;   /* function to handle signal */
        sigset_t sa_mask;               /* additional set of sigs to be */
                                        /* blocked during handler execution */
        int sa_resv[2];
} sigaction_t;
#define sa_handler      sa_sighandler.sa_handler1
#define sa_sigaction    sa_sighandler.sa_sigaction1


The code info/signals.c assumes that the handler is the first element
of the structure.

My fix: Initialize the structure explicity in initialize_info_signal_hander().
   Ezra


*** signals.c   2003/01/28 17:51:26     1.1
--- signals.c   2003/01/28 18:00:40
***************
*** 87,97 ****
  static RETSIGTYPE info_signal_proc ();
  #if defined (HAVE_SIGACTION)
  typedef struct sigaction signal_info;
! signal_info info_signal_handler = {
!   info_signal_proc,
!   0, /* set later */
!   0
! };
  
  static void
  set_termsig (sig, old)
--- 87,93 ----
  static RETSIGTYPE info_signal_proc ();
  #if defined (HAVE_SIGACTION)
  typedef struct sigaction signal_info;
! signal_info info_signal_handler;
  
  static void
  set_termsig (sig, old)
***************
*** 123,128 ****
--- 119,126 ----
  initialize_info_signal_handler ()
  {
  #if defined (HAVE_SIGACTION)
+   info_signal_handler.sa_handler = info_signal_proc;
+   info_signal_handler.sa_flags = 0;
    mask_termsig (&info_signal_handler.sa_mask);
  #endif /* HAVE_SIGACTION */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]