Net: Ignore SIGPIPE errors on POSIX systems.

This should work on BSD/macOS/Linux/iOS/similar.
This commit is contained in:
Unknown W. Brackets 2022-04-02 16:07:51 -07:00
parent a155c49728
commit 170441313c
6 changed files with 35 additions and 0 deletions

View file

@ -32,3 +32,7 @@ charset = utf-8
[libretro/**.{cpp,h}]
indent_style = space
indent_size = 3
[SDL/SDLMain.mm]
indent_style = space
indent_size = 4

View file

@ -48,6 +48,7 @@
#include "Core/ConfigValues.h"
#include "Core/HW/Camera.h"
#include <signal.h>
#include <string.h>
MainUI *emugl = nullptr;
@ -710,6 +711,11 @@ int main(int argc, char *argv[])
}
}
// Ignore sigpipe.
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
perror("Unable to ignore SIGPIPE");
}
PROFILE_INIT();
glslang::InitializeProcess();
#if defined(Q_OS_LINUX)

View file

@ -18,6 +18,7 @@ SDLJoystick *joystick = NULL;
#include <atomic>
#include <algorithm>
#include <cmath>
#include <csignal>
#include <thread>
#include <locale>
@ -519,6 +520,11 @@ int main(int argc, char *argv[]) {
#ifdef HAVE_LIBNX
socketInitializeDefault();
nxlinkStdio();
#else // HAVE_LIBNX
// Ignore sigpipe.
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
perror("Unable to ignore SIGPIPE");
}
#endif // HAVE_LIBNX
PROFILE_INIT();

View file

@ -8,6 +8,7 @@
#include "SDL.h"
#include "SDLMain.h"
#include "Common/Profiler/Profiler.h"
#include <signal.h>
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>
@ -374,6 +375,11 @@ int main (int argc, char **argv)
PROFILE_INIT();
// Ignore sigpipe.
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
perror("Unable to ignore SIGPIPE");
}
#if SDL_USE_NIB_FILE
NSApplicationMain (argc, argv);
#else

View file

@ -17,6 +17,8 @@
#include "Common/CommonWindows.h"
#if PPSSPP_PLATFORM(WINDOWS)
#include <timeapi.h>
#else
#include <csignal>
#endif
#include "Common/CPUDetect.h"
#include "Common/File/VFS/VFS.h"
@ -246,6 +248,11 @@ int main(int argc, const char* argv[])
PROFILE_INIT();
#if PPSSPP_PLATFORM(WINDOWS)
timeBeginPeriod(1);
#else
// Ignore sigpipe.
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
perror("Unable to ignore SIGPIPE");
}
#endif
#if defined(_DEBUG) && defined(_MSC_VER)

View file

@ -4,6 +4,7 @@
#import <dlfcn.h>
#import <mach/mach.h>
#import <pthread.h>
#import <signal.h>
#import <string>
#import <stdio.h>
#import <stdlib.h>
@ -270,6 +271,11 @@ int main(int argc, char *argv[])
PROFILE_INIT();
// Ignore sigpipe.
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
perror("Unable to ignore SIGPIPE");
}
@autoreleasepool {
return UIApplicationMain(argc, argv, NSStringFromClass([PPSSPPUIApplication class]), NSStringFromClass([AppDelegate class]));
}