Skip to content

Commit

Permalink
SIGPIPE is sent when a remote socket is closed.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Apr 20, 2006
1 parent 354348f commit eb25f83
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions SDLnet.c
Expand Up @@ -275,6 +275,10 @@ const char *SDLNet_ResolveIP(IPaddress *ip)

#else /* !MACOS_OPENTRANSPORT */

#ifndef __USE_W32_SOCKETS
#include <signal.h>
#endif

/* Initialize/Cleanup the network API */
int SDLNet_Init(void)
{
Expand All @@ -289,7 +293,12 @@ int SDLNet_Init(void)
return(-1);
}
#else
;
/* SIGPIPE is generated when a remote socket is closed */
void (*handler)(int);
handler = signal(SIGPIPE, SIG_IGN);
if ( handler != SIG_DFL ) {
signal(SIGPIPE, handler);
}
#endif
}
++SDLNet_started;
Expand All @@ -310,7 +319,12 @@ void SDLNet_Quit(void)
}
}
#else
;
/* Restore the SIGPIPE handler */
void (*handler)(int);
handler = signal(SIGPIPE, SIG_DFL);
if ( handler != SIG_IGN ) {
signal(SIGPIPE, handler);
}
#endif
}
}
Expand Down

0 comments on commit eb25f83

Please sign in to comment.