Patch 9.0.1544
Problem:    Recent glibc marks sigset() as a deprecated.
Solution:   Use sigaction() in mch_signal() if possible. (Ozaki Kiichi,
            closes #12373)
Files:      src/gui_haiku.cc, src/main.c, src/misc1.c, src/os_unix.c,
            src/proto/os_unix.pro, src/os_unix.h, src/os_unixx.h,
            src/os_win32.c, src/os_win32.h, src/pty.c, src/vim.h


*** ../vim-9.0.1543/src/gui_haiku.cc    2023-04-18 17:20:05.217542787 +0100
--- src/gui_haiku.cc    2023-05-11 22:14:43.845512755 +0100
***************
*** 785,792 ****
       * Apparently signals are inherited by the created thread -
       * disable the most annoying ones.
       */
!     signal(SIGINT, SIG_IGN);
!     signal(SIGQUIT, SIG_IGN);
  }
  
      void
--- 785,792 ----
       * Apparently signals are inherited by the created thread -
       * disable the most annoying ones.
       */
!     mch_signal(SIGINT, SIG_IGN);
!     mch_signal(SIGQUIT, SIG_IGN);
  }
  
      void
***************
*** 1067,1074 ****
       * Apparently signals are inherited by the created thread -
       * disable the most annoying ones.
       */
!     signal(SIGINT, SIG_IGN);
!     signal(SIGQUIT, SIG_IGN);
  
      if (menuBar && textArea) {
        /*
--- 1067,1074 ----
       * Apparently signals are inherited by the created thread -
       * disable the most annoying ones.
       */
!     mch_signal(SIGINT, SIG_IGN);
!     mch_signal(SIGQUIT, SIG_IGN);
  
      if (menuBar && textArea) {
        /*
*** ../vim-9.0.1543/src/main.c  2023-04-15 13:17:22.879094522 +0100
--- src/main.c  2023-05-11 22:14:43.845512755 +0100
***************
*** 1557,1563 ****
      // Ignore SIGHUP, because a dropped connection causes a read error, which
      // makes Vim exit and then handling SIGHUP causes various reentrance
      // problems.
!     signal(SIGHUP, SIG_IGN);
  # endif
  
      ml_close_notmod();                    // close all not-modified buffers
--- 1557,1563 ----
      // Ignore SIGHUP, because a dropped connection causes a read error, which
      // makes Vim exit and then handling SIGHUP causes various reentrance
      // problems.
!     mch_signal(SIGHUP, SIG_IGN);
  # endif
  
      ml_close_notmod();                    // close all not-modified buffers
*** ../vim-9.0.1543/src/misc1.c 2023-02-21 14:27:34.520360383 +0000
--- src/misc1.c 2023-05-11 22:14:43.849512753 +0100
***************
*** 2208,2214 ****
      // Ignore SIGHUP, because a dropped connection causes a read error, which
      // makes Vim exit and then handling SIGHUP causes various reentrance
      // problems.
!     signal(SIGHUP, SIG_IGN);
  #endif
  
  #ifdef FEAT_GUI
--- 2208,2214 ----
      // Ignore SIGHUP, because a dropped connection causes a read error, which
      // makes Vim exit and then handling SIGHUP causes various reentrance
      // problems.
!     mch_signal(SIGHUP, SIG_IGN);
  #endif
  
  #ifdef FEAT_GUI
*** ../vim-9.0.1543/src/os_unix.c       2023-04-19 20:28:43.866094432 +0100
--- src/os_unix.c       2023-05-11 22:19:54.461417481 +0100
***************
*** 214,220 ****
  static int save_patterns(int num_pat, char_u **pat, int *num_file, char_u 
***file);
  
  #ifndef SIG_ERR
! # define SIG_ERR      ((void (*)())-1)
  #endif
  
  // volatile because it is used in signal handler sig_winch().
--- 214,223 ----
  static int save_patterns(int num_pat, char_u **pat, int *num_file, char_u 
***file);
  
  #ifndef SIG_ERR
! # define SIG_ERR      ((sighandler_T)-1)
! #endif
! #ifndef SIG_HOLD
! # define SIG_HOLD     ((sighandler_T)-2)
  #endif
  
  // volatile because it is used in signal handler sig_winch().
***************
*** 340,345 ****
--- 343,404 ----
      {-1,          "Unknown!", FALSE}
  };
  
+     sighandler_T
+ mch_signal(int sig, sighandler_T func)
+ {
+ #if defined(HAVE_SIGACTION) && defined(HAVE_SIGPROCMASK)
+     // Modern implementation: use sigaction().
+     struct sigaction  sa, old;
+     sigset_t          curset;
+     int                       blocked;
+ 
+     if (sigprocmask(SIG_BLOCK, NULL, &curset) == -1)
+       return SIG_ERR;
+ 
+     blocked = sigismember(&curset, sig);
+ 
+     if (func == SIG_HOLD)
+     {
+       if (blocked)
+           return SIG_HOLD;
+ 
+       sigemptyset(&curset);
+       sigaddset(&curset, sig);
+ 
+       if (sigaction(sig, NULL, &old) == -1
+                               || sigprocmask(SIG_BLOCK, &curset, NULL) == -1)
+           return SIG_ERR;
+       return old.sa_handler;
+     }
+ 
+     if (blocked)
+     {
+       sigemptyset(&curset);
+       sigaddset(&curset, sig);
+ 
+       if (sigprocmask(SIG_UNBLOCK, &curset, NULL) == -1)
+           return SIG_ERR;
+     }
+ 
+     sa.sa_handler = func;
+     sigemptyset(&sa.sa_mask);
+ # ifdef SA_RESTART
+     sa.sa_flags = SA_RESTART;
+ # else
+     sa.sa_flags = 0;
+ # endif
+     if (sigaction(sig, &sa, &old) == -1)
+       return SIG_ERR;
+     return blocked ? SIG_HOLD: old.sa_handler;
+ #elif defined(HAVE_SIGSET)
+     // Using sigset() is preferred above signal().
+     return sigset(sig, func);
+ #else
+     // Oldest and most compatible solution.
+     return signal(sig, func);
+ #endif
+ }
+ 
      int
  mch_chdir(char *path)
  {
***************
*** 349,359 ****
        smsg("chdir(%s)", path);
        verbose_leave();
      }
! # ifdef VMS
      return chdir(vms_fixfilename(path));
! # else
      return chdir(path);
! # endif
  }
  
  // Why is NeXT excluded here (and not in os_unixx.h)?
--- 408,418 ----
        smsg("chdir(%s)", path);
        verbose_leave();
      }
! #ifdef VMS
      return chdir(vms_fixfilename(path));
! #else
      return chdir(path);
! #endif
  }
  
  // Why is NeXT excluded here (and not in os_unixx.h)?
***************
*** 869,875 ****
  sig_winch SIGDEFARG(sigarg)
  {
      // this is not required on all systems, but it doesn't hurt anybody
!     signal(SIGWINCH, (void (*)(int))sig_winch);
      do_resize = TRUE;
  }
  #endif
--- 928,934 ----
  sig_winch SIGDEFARG(sigarg)
  {
      // this is not required on all systems, but it doesn't hurt anybody
!     mch_signal(SIGWINCH, sig_winch);
      do_resize = TRUE;
  }
  #endif
***************
*** 881,887 ****
      // Second time we get called we actually need to suspend
      if (in_mch_suspend)
      {
!       signal(SIGTSTP, ignore_sigtstp ? SIG_IGN : SIG_DFL);
        raise(sigarg);
      }
      else
--- 940,946 ----
      // Second time we get called we actually need to suspend
      if (in_mch_suspend)
      {
!       mch_signal(SIGTSTP, ignore_sigtstp ? SIG_IGN : SIG_DFL);
        raise(sigarg);
      }
      else
***************
*** 890,896 ****
  #if !defined(__ANDROID__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
      // This is not required on all systems.  On some systems (at least 
Android,
      // OpenBSD, and DragonFlyBSD) this breaks suspending with CTRL-Z.
!     signal(SIGTSTP, (void (*)(int))sig_tstp);
  #endif
  }
  #endif
--- 949,955 ----
  #if !defined(__ANDROID__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
      // This is not required on all systems.  On some systems (at least 
Android,
      // OpenBSD, and DragonFlyBSD) this breaks suspending with CTRL-Z.
!     mch_signal(SIGTSTP, sig_tstp);
  #endif
  }
  #endif
***************
*** 900,906 ****
  catch_sigint SIGDEFARG(sigarg)
  {
      // this is not required on all systems, but it doesn't hurt anybody
!     signal(SIGINT, (void (*)(int))catch_sigint);
      got_int = TRUE;
  }
  #endif
--- 959,965 ----
  catch_sigint SIGDEFARG(sigarg)
  {
      // this is not required on all systems, but it doesn't hurt anybody
!     mch_signal(SIGINT, catch_sigint);
      got_int = TRUE;
  }
  #endif
***************
*** 910,916 ****
  catch_sigusr1 SIGDEFARG(sigarg)
  {
      // this is not required on all systems, but it doesn't hurt anybody
!     signal(SIGUSR1, (void (*)(int))catch_sigusr1);
      got_sigusr1 = TRUE;
  }
  #endif
--- 969,975 ----
  catch_sigusr1 SIGDEFARG(sigarg)
  {
      // this is not required on all systems, but it doesn't hurt anybody
!     mch_signal(SIGUSR1, catch_sigusr1);
      got_sigusr1 = TRUE;
  }
  #endif
***************
*** 920,926 ****
  catch_sigpwr SIGDEFARG(sigarg)
  {
      // this is not required on all systems, but it doesn't hurt anybody
!     signal(SIGPWR, (void (*)())catch_sigpwr);
      /*
       * I'm not sure we get the SIGPWR signal when the system is really going
       * down or when the batteries are almost empty.  Just preserve the swap
--- 979,985 ----
  catch_sigpwr SIGDEFARG(sigarg)
  {
      // this is not required on all systems, but it doesn't hurt anybody
!     mch_signal(SIGPWR, catch_sigpwr);
      /*
       * I'm not sure we get the SIGPWR signal when the system is really going
       * down or when the batteries are almost empty.  Just preserve the swap
***************
*** 1364,1370 ****
      // that indicates the shell (or program) that launched us does not support
      // tty job control and thus we should ignore that signal. If invoked as a
      // restricted editor (e.g., as "rvim") SIGTSTP is always ignored.
!     ignore_sigtstp = restricted || SIG_IGN == signal(SIGTSTP, SIG_ERR);
  #endif
      set_signals();
  
--- 1423,1429 ----
      // that indicates the shell (or program) that launched us does not support
      // tty job control and thus we should ignore that signal. If invoked as a
      // restricted editor (e.g., as "rvim") SIGTSTP is always ignored.
!     ignore_sigtstp = restricted || SIG_IGN == mch_signal(SIGTSTP, SIG_ERR);
  #endif
      set_signals();
  
***************
*** 1383,1389 ****
      /*
       * WINDOW CHANGE signal is handled with sig_winch().
       */
!     signal(SIGWINCH, (void (*)(int))sig_winch);
  #endif
  
  #ifdef SIGTSTP
--- 1442,1448 ----
      /*
       * WINDOW CHANGE signal is handled with sig_winch().
       */
!     mch_signal(SIGWINCH, sig_winch);
  #endif
  
  #ifdef SIGTSTP
***************
*** 1391,1410 ****
      // In the GUI default TSTP processing is OK.
      // Checking both gui.in_use and gui.starting because gui.in_use is not set
      // at this point (set after menus are displayed), but gui.starting is set.
!     signal(SIGTSTP, ignore_sigtstp ? SIG_IGN
  # ifdef FEAT_GUI
                                : gui.in_use || gui.starting ? SIG_DFL
  # endif
!                                   : (void (*)(int))sig_tstp);
  #endif
  #if defined(SIGCONT)
!     signal(SIGCONT, sigcont_handler);
  #endif
  #ifdef SIGPIPE
      /*
       * We want to ignore breaking of PIPEs.
       */
!     signal(SIGPIPE, SIG_IGN);
  #endif
  
  #ifdef SIGINT
--- 1450,1469 ----
      // In the GUI default TSTP processing is OK.
      // Checking both gui.in_use and gui.starting because gui.in_use is not set
      // at this point (set after menus are displayed), but gui.starting is set.
!     mch_signal(SIGTSTP, ignore_sigtstp ? SIG_IGN
  # ifdef FEAT_GUI
                                : gui.in_use || gui.starting ? SIG_DFL
  # endif
!                                   : sig_tstp);
  #endif
  #if defined(SIGCONT)
!     mch_signal(SIGCONT, sigcont_handler);
  #endif
  #ifdef SIGPIPE
      /*
       * We want to ignore breaking of PIPEs.
       */
!     mch_signal(SIGPIPE, SIG_IGN);
  #endif
  
  #ifdef SIGINT
***************
*** 1415,1428 ****
      /*
       * Call user's handler on SIGUSR1
       */
!     signal(SIGUSR1, (void (*)(int))catch_sigusr1);
  #endif
  
      /*
       * Ignore alarm signals (Perl's alarm() generates it).
       */
  #ifdef SIGALRM
!     signal(SIGALRM, SIG_IGN);
  #endif
  
  #ifdef SIGPWR
--- 1474,1487 ----
      /*
       * Call user's handler on SIGUSR1
       */
!     mch_signal(SIGUSR1, catch_sigusr1);
  #endif
  
      /*
       * Ignore alarm signals (Perl's alarm() generates it).
       */
  #ifdef SIGALRM
!     mch_signal(SIGALRM, SIG_IGN);
  #endif
  
  #ifdef SIGPWR
***************
*** 1430,1436 ****
       * Catch SIGPWR (power failure?) to preserve the swap files, so that no
       * work will be lost.
       */
!     signal(SIGPWR, (void (*)())catch_sigpwr);
  #endif
  
      /*
--- 1489,1495 ----
       * Catch SIGPWR (power failure?) to preserve the swap files, so that no
       * work will be lost.
       */
!     mch_signal(SIGPWR, catch_sigpwr);
  #endif
  
      /*
***************
*** 1443,1449 ****
       * When the GUI is running, ignore the hangup signal.
       */
      if (gui.in_use)
!       signal(SIGHUP, SIG_IGN);
  #endif
  }
  
--- 1502,1508 ----
       * When the GUI is running, ignore the hangup signal.
       */
      if (gui.in_use)
!       mch_signal(SIGHUP, SIG_IGN);
  #endif
  }
  
***************
*** 1454,1460 ****
      static void
  catch_int_signal(void)
  {
!     signal(SIGINT, (void (*)(int))catch_sigint);
  }
  #endif
  
--- 1513,1519 ----
      static void
  catch_int_signal(void)
  {
!     mch_signal(SIGINT, catch_sigint);
  }
  #endif
  
***************
*** 1464,1470 ****
      catch_signals(SIG_DFL, SIG_DFL);
  #if defined(SIGCONT)
      // SIGCONT isn't in the list, because its default action is ignore
!     signal(SIGCONT, SIG_DFL);
  #endif
  }
  
--- 1523,1529 ----
      catch_signals(SIG_DFL, SIG_DFL);
  #if defined(SIGCONT)
      // SIGCONT isn't in the list, because its default action is ignore
!     mch_signal(SIGCONT, SIG_DFL);
  #endif
  }
  
***************
*** 1506,1512 ****
            sv.sv_flags = SV_ONSTACK;
            sigvec(signal_info[i].sig, &sv, NULL);
  # else
!           signal(signal_info[i].sig, func_deadly);
  # endif
  #endif
        }
--- 1565,1571 ----
            sv.sv_flags = SV_ONSTACK;
            sigvec(signal_info[i].sig, &sv, NULL);
  # else
!           mch_signal(signal_info[i].sig, func_deadly);
  # endif
  #endif
        }
***************
*** 1514,1524 ****
        {
            // Deal with non-deadly signals.
  #ifdef SIGTSTP
!           signal(signal_info[i].sig,
                    signal_info[i].sig == SIGTSTP && ignore_sigtstp
                                                       ? SIG_IGN : func_other);
  #else
!           signal(signal_info[i].sig, func_other);
  #endif
        }
      }
--- 1573,1583 ----
        {
            // Deal with non-deadly signals.
  #ifdef SIGTSTP
!           mch_signal(signal_info[i].sig,
                    signal_info[i].sig == SIGTSTP && ignore_sigtstp
                                                       ? SIG_IGN : func_other);
  #else
!           mch_signal(signal_info[i].sig, func_other);
  #endif
        }
      }
***************
*** 1923,1929 ****
      if (x11_window != 0 && x11_display == NULL)
      {
  #ifdef SET_SIG_ALARM
!       void (*sig_save)();
  #endif
  #ifdef ELAPSED_FUNC
        elapsed_T start_tv;
--- 1982,1988 ----
      if (x11_window != 0 && x11_display == NULL)
      {
  #ifdef SET_SIG_ALARM
!       sighandler_T sig_save;
  #endif
  #ifdef ELAPSED_FUNC
        elapsed_T start_tv;
***************
*** 1938,1951 ****
         * the network connection is bad.  Set an alarm timer to get out.
         */
        sig_alarm_called = FALSE;
!       sig_save = (void (*)())signal(SIGALRM, (void (*)())sig_alarm);
        alarm(2);
  #endif
        x11_display = XOpenDisplay(NULL);
  
  #ifdef SET_SIG_ALARM
        alarm(0);
!       signal(SIGALRM, (void (*)())sig_save);
        if (p_verbose > 0 && sig_alarm_called)
            verb_msg(_("Opening the X display timed out"));
  #endif
--- 1997,2010 ----
         * the network connection is bad.  Set an alarm timer to get out.
         */
        sig_alarm_called = FALSE;
!       sig_save = mch_signal(SIGALRM, sig_alarm);
        alarm(2);
  #endif
        x11_display = XOpenDisplay(NULL);
  
  #ifdef SET_SIG_ALARM
        alarm(0);
!       mch_signal(SIGALRM, sig_save);
        if (p_verbose > 0 && sig_alarm_called)
            verb_msg(_("Opening the X display timed out"));
  #endif
***************
*** 3519,3525 ****
  {
      if (deadly_signal != 0)
      {
!       signal(deadly_signal, SIG_DFL);
        kill(getpid(), deadly_signal);  // Die using the signal we caught
      }
  }
--- 3578,3584 ----
  {
      if (deadly_signal != 0)
      {
!       mch_signal(deadly_signal, SIG_DFL);
        kill(getpid(), deadly_signal);  // Die using the signal we caught
      }
  }
***************
*** 4828,4834 ****
                    // will exit and send SIGHUP to all processes in its
                    // group, killing the just started process.  Ignore SIGHUP
                    // to avoid that. (suggested by Simon Schubert)
!                   signal(SIGHUP, SIG_IGN);
  #  endif
                }
  # endif
--- 4887,4893 ----
                    // will exit and send SIGHUP to all processes in its
                    // group, killing the just started process.  Ignore SIGHUP
                    // to avoid that. (suggested by Simon Schubert)
!                   mch_signal(SIGHUP, SIG_IGN);
  #  endif
                }
  # endif
***************
*** 7283,7289 ****
        // we are going to suspend or starting an external process
        // so we shouldn't  have problem with this
  # ifdef SIGTSTP
!       signal(SIGTSTP, restricted ? SIG_IGN : (void (*)())sig_tstp);
  # endif
        return 1; // succeed
      }
--- 7342,7348 ----
        // we are going to suspend or starting an external process
        // so we shouldn't  have problem with this
  # ifdef SIGTSTP
!       mch_signal(SIGTSTP, restricted ? SIG_IGN : sig_tstp);
  # endif
        return 1; // succeed
      }
***************
*** 7415,7421 ****
      if (ioctl(1, CONS_MOUSECTL, &mouse) == -1)
        return FAIL;
  
!     signal(SIGUSR2, (void (*)())sig_sysmouse);
      mouse.operation = MOUSE_SHOW;
      ioctl(1, CONS_MOUSECTL, &mouse);
      return OK;
--- 7474,7480 ----
      if (ioctl(1, CONS_MOUSECTL, &mouse) == -1)
        return FAIL;
  
!     mch_signal(SIGUSR2, sig_sysmouse);
      mouse.operation = MOUSE_SHOW;
      ioctl(1, CONS_MOUSECTL, &mouse);
      return OK;
***************
*** 7430,7436 ****
  {
      struct mouse_info mouse;
  
!     signal(SIGUSR2, restricted ? SIG_IGN : SIG_DFL);
      mouse.operation = MOUSE_MODE;
      mouse.u.mode.mode = 0;
      mouse.u.mode.signal = 0;
--- 7489,7495 ----
  {
      struct mouse_info mouse;
  
!     mch_signal(SIGUSR2, restricted ? SIG_IGN : SIG_DFL);
      mouse.operation = MOUSE_MODE;
      mouse.u.mode.mode = 0;
      mouse.u.mode.signal = 0;
*** ../vim-9.0.1543/src/proto/os_unix.pro       2022-11-25 15:09:30.710402884 
+0000
--- src/proto/os_unix.pro       2023-05-11 22:17:31.065444057 +0100
***************
*** 1,4 ****
--- 1,5 ----
  /* os_unix.c */
+ sighandler_T mch_signal(int sig, sighandler_T func);
  int mch_chdir(char *path);
  void mch_write(char_u *s, int len);
  int mch_inchar(char_u *buf, int maxlen, long wtime, int tb_change_cnt);
*** ../vim-9.0.1543/src/os_unix.h       2022-08-27 21:24:22.709002324 +0100
--- src/os_unix.h       2023-05-11 22:14:43.849512753 +0100
***************
*** 98,103 ****
--- 98,105 ----
  # define SIGDUMMYARG
  #endif
  
+ typedef void (*sighandler_T) SIGPROTOARG;
+ 
  #ifdef HAVE_DIRENT_H
  # include <dirent.h>
  # ifndef NAMLEN
*** ../vim-9.0.1543/src/os_unixx.h      2020-03-16 21:50:46.000000000 +0000
--- src/os_unixx.h      2023-05-11 22:14:43.849512753 +0100
***************
*** 10,23 ****
   * os_unixx.h -- include files that are only used in os_unix.c
   */
  
! /*
!  * Stuff for signals
!  */
! #if defined(HAVE_SIGSET) && !defined(signal)
! # define signal sigset
! #endif
! 
!    // Sun's sys/ioctl.h redefines symbols from termio world
  #if defined(HAVE_SYS_IOCTL_H) && !defined(SUN_SYSTEM)
  # include <sys/ioctl.h>
  #endif
--- 10,16 ----
   * os_unixx.h -- include files that are only used in os_unix.c
   */
  
! // Sun's sys/ioctl.h redefines symbols from termio world
  #if defined(HAVE_SYS_IOCTL_H) && !defined(SUN_SYSTEM)
  # include <sys/ioctl.h>
  #endif
*** ../vim-9.0.1543/src/os_win32.c      2023-05-09 14:59:55.964088966 +0100
--- src/os_win32.c      2023-05-11 22:14:43.849512753 +0100
***************
*** 5441,5457 ****
       * Catch all deadly signals while running the external command, because a
       * CTRL-C, Ctrl-Break or illegal instruction  might otherwise kill us.
       */
!     signal(SIGINT, SIG_IGN);
  #if defined(__GNUC__) && !defined(__MINGW32__)
!     signal(SIGKILL, SIG_IGN);
  #else
!     signal(SIGBREAK, SIG_IGN);
  #endif
!     signal(SIGILL, SIG_IGN);
!     signal(SIGFPE, SIG_IGN);
!     signal(SIGSEGV, SIG_IGN);
!     signal(SIGTERM, SIG_IGN);
!     signal(SIGABRT, SIG_IGN);
  
      if (options & SHELL_COOKED)
        settmode(TMODE_COOK);   // set to normal mode
--- 5441,5457 ----
       * Catch all deadly signals while running the external command, because a
       * CTRL-C, Ctrl-Break or illegal instruction  might otherwise kill us.
       */
!     mch_signal(SIGINT, SIG_IGN);
  #if defined(__GNUC__) && !defined(__MINGW32__)
!     mch_signal(SIGKILL, SIG_IGN);
  #else
!     mch_signal(SIGBREAK, SIG_IGN);
  #endif
!     mch_signal(SIGILL, SIG_IGN);
!     mch_signal(SIGFPE, SIG_IGN);
!     mch_signal(SIGSEGV, SIG_IGN);
!     mch_signal(SIGTERM, SIG_IGN);
!     mch_signal(SIGABRT, SIG_IGN);
  
      if (options & SHELL_COOKED)
        settmode(TMODE_COOK);   // set to normal mode
***************
*** 5680,5696 ****
      }
      resettitle();
  
!     signal(SIGINT, SIG_DFL);
  #if defined(__GNUC__) && !defined(__MINGW32__)
!     signal(SIGKILL, SIG_DFL);
  #else
!     signal(SIGBREAK, SIG_DFL);
  #endif
!     signal(SIGILL, SIG_DFL);
!     signal(SIGFPE, SIG_DFL);
!     signal(SIGSEGV, SIG_DFL);
!     signal(SIGTERM, SIG_DFL);
!     signal(SIGABRT, SIG_DFL);
  
      return x;
  }
--- 5680,5696 ----
      }
      resettitle();
  
!     mch_signal(SIGINT, SIG_DFL);
  #if defined(__GNUC__) && !defined(__MINGW32__)
!     mch_signal(SIGKILL, SIG_DFL);
  #else
!     mch_signal(SIGBREAK, SIG_DFL);
  #endif
!     mch_signal(SIGILL, SIG_DFL);
!     mch_signal(SIGFPE, SIG_DFL);
!     mch_signal(SIGSEGV, SIG_DFL);
!     mch_signal(SIGTERM, SIG_DFL);
!     mch_signal(SIGABRT, SIG_DFL);
  
      return x;
  }
*** ../vim-9.0.1543/src/os_win32.h      2022-10-17 14:51:31.694963479 +0100
--- src/os_win32.h      2023-05-11 22:14:43.849512753 +0100
***************
*** 95,100 ****
--- 95,102 ----
  # endif
  #endif
  
+ typedef void (*sighandler_T)(int, int);
+ 
  /*
   * Win32 has plenty of memory, use large buffers
   */
*** ../vim-9.0.1543/src/pty.c   2022-08-27 21:24:22.709002324 +0100
--- src/pty.c   2023-05-11 22:14:43.849512753 +0100
***************
*** 186,194 ****
      int
  mch_openpty(char **ttyn)
  {
!     int               f;
!     char      *m;
!     void (*sigcld) SIGPROTOARG;
      static char TtyName[32];  // used for opening a new pty-pair
  
      if ((f = posix_openpt(O_RDWR | O_NOCTTY | O_EXTRA)) == -1)
--- 186,194 ----
      int
  mch_openpty(char **ttyn)
  {
!     int                       f;
!     char              *m;
!     sighandler_T      sigcld;
      static char TtyName[32];  // used for opening a new pty-pair
  
      if ((f = posix_openpt(O_RDWR | O_NOCTTY | O_EXTRA)) == -1)
***************
*** 196,209 ****
  
      // SIGCHLD set to SIG_DFL for grantpt() because it fork()s and
      // exec()s pt_chmod
!     sigcld = signal(SIGCHLD, SIG_DFL);
      if ((m = ptsname(f)) == NULL || grantpt(f) || unlockpt(f))
      {
!       signal(SIGCHLD, sigcld);
        close(f);
        return -1;
      }
!     signal(SIGCHLD, sigcld);
      vim_strncpy((char_u *)TtyName, (char_u *)m, sizeof(TtyName) - 1);
      initmaster(f);
      *ttyn = TtyName;
--- 196,209 ----
  
      // SIGCHLD set to SIG_DFL for grantpt() because it fork()s and
      // exec()s pt_chmod
!     sigcld = mch_signal(SIGCHLD, SIG_DFL);
      if ((m = ptsname(f)) == NULL || grantpt(f) || unlockpt(f))
      {
!       mch_signal(SIGCHLD, sigcld);
        close(f);
        return -1;
      }
!     mch_signal(SIGCHLD, sigcld);
      vim_strncpy((char_u *)TtyName, (char_u *)m, sizeof(TtyName) - 1);
      initmaster(f);
      *ttyn = TtyName;
***************
*** 285,293 ****
      int
  mch_openpty(char **ttyn)
  {
!     int               f;
!     char      *m;
!     void (*sigcld) SIGPROTOARG;
      // used for opening a new pty-pair:
      static char TtyName[32];
  
--- 285,293 ----
      int
  mch_openpty(char **ttyn)
  {
!     int                       f;
!     char              *m;
!     sighandler_T      sigcld;
      // used for opening a new pty-pair:
      static char TtyName[32];
  
***************
*** 298,311 ****
       * SIGCHLD set to SIG_DFL for grantpt() because it fork()s and
       * exec()s pt_chmod
       */
!     sigcld = signal(SIGCHLD, SIG_DFL);
      if ((m = ptsname(f)) == NULL || grantpt(f) || unlockpt(f))
      {
!       signal(SIGCHLD, sigcld);
        close(f);
        return -1;
      }
!     signal(SIGCHLD, sigcld);
      vim_strncpy((char_u *)TtyName, (char_u *)m, sizeof(TtyName) - 1);
      initmaster(f);
      *ttyn = TtyName;
--- 298,311 ----
       * SIGCHLD set to SIG_DFL for grantpt() because it fork()s and
       * exec()s pt_chmod
       */
!     sigcld = mch_signal(SIGCHLD, SIG_DFL);
      if ((m = ptsname(f)) == NULL || grantpt(f) || unlockpt(f))
      {
!       mch_signal(SIGCHLD, sigcld);
        close(f);
        return -1;
      }
!     mch_signal(SIGCHLD, sigcld);
      vim_strncpy((char_u *)TtyName, (char_u *)m, sizeof(TtyName) - 1);
      initmaster(f);
      *ttyn = TtyName;
*** ../vim-9.0.1543/src/vim.h   2023-05-04 18:58:18.410209481 +0100
--- src/vim.h   2023-05-11 22:22:04.805412791 +0100
***************
*** 242,247 ****
--- 242,250 ----
  #if (defined(UNIX) || defined(VMS)) \
        && (!defined(MACOS_X) || defined(HAVE_CONFIG_H))
  # include "os_unix.h"     // bring lots of system header files
+ #else
+   // For all non-Unix systems: use old-fashioned signal().
+ # define mch_signal(signum, sighandler) signal(signum, sighandler)
  #endif
  
  // Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter
*** ../vim-9.0.1543/src/version.c       2023-05-11 19:23:49.217031318 +0100
--- src/version.c       2023-05-11 22:17:17.377448000 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1544,
  /**/

-- 
In many of the more relaxed civilizations on the Outer Eastern Rim of the
Galaxy, "The Hitchhiker's Guide to the Galaxy" has already supplanted the
great "Encyclopedia Galactica" as the standard repository of all knowledge
and wisdom, for though it has many omissions and contains much that is
apocryphal, or at least wildly inaccurate, it scores over the older, more
pedestrian work in two important respects.
First, it is slightly cheaper; and second, it has the words "DON'T PANIC"
inscribed in large friendly letters on its cover.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230511212621.015A51C1B21%40moolenaar.net.

Raspunde prin e-mail lui