sigaction

This commit is contained in:
David Rose 2009-08-19 00:17:04 +00:00
parent 3329c91dba
commit 25117835e0
4 changed files with 25 additions and 12 deletions

View File

@ -66,6 +66,15 @@ P3DInstanceManager() {
icc.dwICC = ICC_PROGRESS_CLASS;
InitCommonControlsEx(&icc);
#endif
#ifndef _WIN32
// On Mac or Linux, we'd better ignore SIGPIPE, or this signal will
// shut down the browser if the plugin exits unexpectedly.
struct sigaction ignore;
memset(&ignore, 0, sizeof(ignore));
ignore.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &ignore, &_old_sigpipe);
#endif // _WIN32
}
////////////////////////////////////////////////////////////////////
@ -84,6 +93,11 @@ P3DInstanceManager::
_started_notify_thread = false;
}
#ifndef _WIN32
// Restore the original SIGPIPE handler.
sigaction(SIGPIPE, &_old_sigpipe, NULL);
#endif // _WIN32
if (_xcontents != NULL) {
delete _xcontents;
}

View File

@ -22,6 +22,10 @@
#include <map>
#include <vector>
#ifndef _WIN32
#include <signal.h>
#endif
class P3DInstance;
class P3DSession;
class P3DPackage;
@ -135,6 +139,10 @@ private:
NotifyInstances _notify_instances;
P3DConditionVar _notify_ready;
#ifndef _WIN32
struct sigaction _old_sigpipe;
#endif
static P3DInstanceManager *_global_ptr;
};

View File

@ -21,10 +21,6 @@
#include <malloc.h>
#endif
#ifdef __APPLE__
#include <signal.h>
#endif
static ofstream logfile;
ostream *nout_stream = &logfile;
@ -134,12 +130,6 @@ NP_Initialize(NPNetscapeFuncs *browserFuncs,
}
#endif
#ifdef __APPLE__
// On Mac, we'd better ignore SIGPIPE, or this signal will shut down
// the application if the plugin exits unexpectedly.
signal(SIGPIPE, SIG_IGN);
#endif // __APPLE__
return NPERR_NO_ERROR;
}

View File

@ -1929,7 +1929,8 @@ class Packager:
if filename:
newFilename = Filename('/'.join(moduleName.split('.')))
newFilename.setExtension(filename.getExtension())
package.addFile(filename, newName = newFilename.cStr(),
self.currentPackage.addFile(
filename, newName = newFilename.cStr(),
deleteTemp = True, explicit = True, extract = True)
self.currentPackage.mainModule = (moduleName, newName)