moonbridge

diff moonbridge.c @ 265:37aaca00941c

Backup and restore errno in signal handler
author jbe
date Sun Jun 04 13:49:12 2017 +0200 (2017-06-04)
parents 30a04a6a45db
children 694446c1316b
line diff
     1.1 --- a/moonbridge.c	Sun Jun 04 13:43:09 2017 +0200
     1.2 +++ b/moonbridge.c	Sun Jun 04 13:49:12 2017 +0200
     1.3 @@ -295,6 +295,7 @@
     1.4  
     1.5  /* Signal handler for master and child processes */
     1.6  static void moonbr_signal(int sig) {
     1.7 +  int errno2 = errno;  /* backup errno variable */
     1.8    if (getpid() == moonbr_masterpid) {
     1.9      /* master process */
    1.10      switch (sig) {
    1.11 @@ -326,6 +327,7 @@
    1.12        kill(moonbr_masterpid, sig);
    1.13      }
    1.14    }
    1.15 +  errno = errno2;  /* restore errno from backup */
    1.16  }
    1.17  
    1.18  /* Initialize signal handling */

Impressum / About Us