mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 03:32:24 +00:00
dtlogin: use POSIX.1 non-local jumps.
This commit is contained in:
parent
9077b5fd85
commit
5fb7f4da67
9 changed files with 41 additions and 43 deletions
|
@ -58,7 +58,6 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/signal.h>
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
# include <signal.h>
|
||||
# include <X11/Xatom.h>
|
||||
# include <X11/Xmu/Error.h>
|
||||
# include <setjmp.h>
|
||||
#if defined(__FreeBSD__) && OSMAJORVERSION > 8
|
||||
# include <utmpx.h>
|
||||
#else
|
||||
|
|
|
@ -110,12 +110,12 @@ killWindows( Display *dpy, Window window )
|
|||
}
|
||||
}
|
||||
|
||||
static jmp_buf resetJmp;
|
||||
static sigjmp_buf resetJmp;
|
||||
|
||||
static SIGVAL
|
||||
abortReset( int arg )
|
||||
{
|
||||
longjmp (resetJmp, 1);
|
||||
siglongjmp (resetJmp, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -128,7 +128,7 @@ pseudoReset( Display *dpy )
|
|||
Window root;
|
||||
int screen;
|
||||
|
||||
if (setjmp (resetJmp)) {
|
||||
if (sigsetjmp (resetJmp, 1)) {
|
||||
LogError(
|
||||
ReadCatalog(MC_LOG_SET,MC_LOG_PSEUDO,MC_DEF_LOG_PSEUDO));
|
||||
} else {
|
||||
|
|
|
@ -223,14 +223,14 @@ StartServer( struct display *d )
|
|||
* the sleep finishes, 0 else
|
||||
*/
|
||||
|
||||
static jmp_buf pauseAbort;
|
||||
static sigjmp_buf pauseAbort;
|
||||
static int serverPauseRet;
|
||||
|
||||
static SIGVAL
|
||||
serverPauseAbort( int arg )
|
||||
{
|
||||
Debug ("Display Manager pause timed out\n");
|
||||
longjmp (pauseAbort, 1);
|
||||
siglongjmp (pauseAbort, 1);
|
||||
}
|
||||
|
||||
static SIGVAL
|
||||
|
@ -238,7 +238,7 @@ serverPauseUsr1( int arg )
|
|||
{
|
||||
Debug ("Display Manager pause received SIGUSR1\n");
|
||||
++receivedUsr1;
|
||||
longjmp (pauseAbort, 1);
|
||||
siglongjmp (pauseAbort, 1);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -248,7 +248,7 @@ serverPause( unsigned t, int serverPid )
|
|||
|
||||
serverPauseRet = 0;
|
||||
Debug ("Display Manager pausing until SIGUSR1 from server or timeout\n");
|
||||
if (!setjmp (pauseAbort)) {
|
||||
if (!sigsetjmp (pauseAbort, 1)) {
|
||||
signal (SIGALRM, serverPauseAbort);
|
||||
signal (SIGUSR1, serverPauseUsr1);
|
||||
#ifdef SYSV
|
||||
|
@ -308,17 +308,17 @@ serverPause( unsigned t, int serverPid )
|
|||
/*
|
||||
* this code is complicated by some TCP failings. On
|
||||
* many systems, the connect will occasionally hang forever,
|
||||
* this trouble is avoided by setting up a timeout to longjmp
|
||||
* this trouble is avoided by setting up a timeout to siglongjmp
|
||||
* out of the connect (possibly leaving piles of garbage around
|
||||
* inside Xlib) and give up, terminating the server.
|
||||
*/
|
||||
|
||||
static jmp_buf openAbort;
|
||||
static sigjmp_buf openAbort;
|
||||
|
||||
static SIGVAL
|
||||
abortOpen( int arg )
|
||||
{
|
||||
longjmp (openAbort, 1);
|
||||
siglongjmp (openAbort, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -378,7 +378,7 @@ WaitForServer( struct display *d )
|
|||
for (i = 0; i < (d->openRepeat > 0 ? d->openRepeat : 1); i++) {
|
||||
(void) signal (SIGALRM, abortOpen);
|
||||
(void) alarm ((unsigned) d->openTimeout);
|
||||
if (!setjmp (openAbort)) {
|
||||
if (!sigsetjmp (openAbort, 1)) {
|
||||
Debug ("Before XOpenDisplay(%s)\n", d->name);
|
||||
errno = 0;
|
||||
dpy = XOpenDisplay (d->name);
|
||||
|
@ -443,14 +443,14 @@ ResetServer( struct display *d )
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
static jmp_buf pingTime;
|
||||
static sigjmp_buf pingTime;
|
||||
static int serverDead = FALSE;
|
||||
|
||||
static SIGVAL
|
||||
PingLost( int arg )
|
||||
{
|
||||
serverDead = TRUE;
|
||||
longjmp (pingTime, 1);
|
||||
siglongjmp (pingTime, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -458,7 +458,7 @@ static SIGVAL
|
|||
PingBlocked( int arg )
|
||||
{
|
||||
serverDead = FALSE;
|
||||
longjmp (pingTime, 1);
|
||||
siglongjmp (pingTime, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -475,7 +475,7 @@ PingServer( struct display *d, Display *alternateDpy )
|
|||
oldAlarm = alarm (0);
|
||||
oldSig = signal (SIGALRM, PingBlocked);
|
||||
alarm (d->pingTimeout * 60);
|
||||
if (!setjmp (pingTime))
|
||||
if (!sigsetjmp (pingTime, 1))
|
||||
{
|
||||
Debug ("Ping server\n");
|
||||
XNoOp (alternateDpy);
|
||||
|
|
|
@ -239,7 +239,7 @@ static struct greet_info greet;
|
|||
static struct verify_info verify;
|
||||
static char *defaultLanguage = NULL;
|
||||
|
||||
static jmp_buf abortSession;
|
||||
static sigjmp_buf abortSession;
|
||||
|
||||
#ifdef BLS
|
||||
static char *sensitivityLevel;
|
||||
|
@ -257,15 +257,15 @@ XrmDatabase XDB;
|
|||
static SIGVAL
|
||||
catchTerm( int arg )
|
||||
{
|
||||
longjmp (abortSession, 1);
|
||||
siglongjmp (abortSession, 1);
|
||||
}
|
||||
|
||||
static jmp_buf pingTime;
|
||||
static sigjmp_buf pingTime;
|
||||
|
||||
static SIGVAL
|
||||
catchAlrm( int arg )
|
||||
{
|
||||
longjmp (pingTime, 1);
|
||||
siglongjmp (pingTime, 1);
|
||||
}
|
||||
|
||||
#if defined(__STDC__)
|
||||
|
@ -522,7 +522,7 @@ ManageSession( struct display *d )
|
|||
#endif
|
||||
|
||||
clientPid = 0;
|
||||
if (!setjmp (abortSession)) {
|
||||
if (!sigsetjmp (abortSession, 1)) {
|
||||
signal (SIGTERM, catchTerm);
|
||||
/*
|
||||
* Start the clients, changing uid/groups
|
||||
|
@ -543,7 +543,7 @@ ManageSession( struct display *d )
|
|||
for (;;) {
|
||||
if (d->pingInterval)
|
||||
{
|
||||
if (!setjmp (pingTime))
|
||||
if (!sigsetjmp (pingTime, 1))
|
||||
{
|
||||
signal (SIGALRM, catchAlrm);
|
||||
alarm (d->pingInterval * 60);
|
||||
|
@ -1064,12 +1064,12 @@ DeleteXloginResources( struct display *d, Display *dpy )
|
|||
|
||||
#if 0 /* dead code: transferred to Dtgreet */
|
||||
|
||||
static jmp_buf syncJump;
|
||||
static sigjmp_buf syncJump;
|
||||
|
||||
static SIGVAL
|
||||
syncTimeout ()
|
||||
{
|
||||
longjmp (syncJump, 1);
|
||||
siglongjmp (syncJump, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1079,7 +1079,7 @@ Display *dpy;
|
|||
{
|
||||
Debug ("SecureDisplay():\n");
|
||||
signal (SIGALRM, syncTimeout);
|
||||
if (setjmp (syncJump)) {
|
||||
if (sigsetjmp (syncJump, 1)) {
|
||||
LogError(ReadCatalog(MC_LOG_SET,MC_LOG_NO_SECDPY,MC_DEF_LOG_NO_SECDPY),
|
||||
d->name);
|
||||
SessionExit (d, RESERVER_DISPLAY);
|
||||
|
@ -1689,12 +1689,12 @@ StartClient( struct verify_info *verify, struct display *d, int *pidp )
|
|||
}
|
||||
}
|
||||
|
||||
static jmp_buf tenaciousClient;
|
||||
static sigjmp_buf tenaciousClient;
|
||||
|
||||
static SIGVAL
|
||||
waitAbort( int arg )
|
||||
{
|
||||
longjmp (tenaciousClient, 1);
|
||||
siglongjmp (tenaciousClient, 1);
|
||||
}
|
||||
|
||||
#if defined(SYSV) || defined(SVR4)
|
||||
|
@ -1723,7 +1723,7 @@ AbortClient( int pid )
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
if (!setjmp (tenaciousClient)) {
|
||||
if (!sigsetjmp (tenaciousClient, 1)) {
|
||||
(void) signal (SIGALRM, waitAbort);
|
||||
(void) alarm ((unsigned) 10);
|
||||
retId = wait ((waitType *) 0);
|
||||
|
@ -1948,7 +1948,7 @@ RunGreeter( struct display *d, struct greet_info *greet,
|
|||
#endif
|
||||
|
||||
greeterPid = 0;
|
||||
if (!setjmp (abortSession)) {
|
||||
if (!sigsetjmp (abortSession, 1)) {
|
||||
signal(SIGTERM, catchTerm);
|
||||
|
||||
/*
|
||||
|
|
|
@ -428,13 +428,13 @@ SetHourGlassCursor( Display *dpy, Window w )
|
|||
|
||||
#define DELIM " \t" /* delimiters in language list */
|
||||
|
||||
static jmp_buf langJump;
|
||||
static sigjmp_buf langJump;
|
||||
|
||||
static SIGVAL
|
||||
MakeLangAbort( int arg )
|
||||
|
||||
{
|
||||
longjmp (langJump, 1);
|
||||
siglongjmp (langJump, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -459,7 +459,7 @@ MakeLangList( void )
|
|||
signal (SIGALRM, MakeLangAbort);
|
||||
alarm ((unsigned) langListTimeout);
|
||||
|
||||
if (!setjmp (langJump)) {
|
||||
if (!sigsetjmp (langJump, 1)) {
|
||||
ScanNLSDir(DEF_NLS_DIR);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -947,7 +947,7 @@ OptionsUnmapCB( Widget wd, XtPointer client_data, XtPointer call_data )
|
|||
*
|
||||
***************************************************************************/
|
||||
|
||||
static jmp_buf pingTime;
|
||||
static sigjmp_buf pingTime;
|
||||
static int serverDead = FALSE;
|
||||
static int pingInterval = 0; /* ping interval (sec.) */
|
||||
static int pingTimeout; /* ping timeout (sec.) */
|
||||
|
@ -956,7 +956,7 @@ static void
|
|||
PingLost( void )
|
||||
{
|
||||
serverDead = TRUE;
|
||||
longjmp (pingTime, 1);
|
||||
siglongjmp (pingTime, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -965,7 +965,7 @@ PingBlocked( int arg )
|
|||
|
||||
{
|
||||
serverDead = TRUE;
|
||||
longjmp (pingTime, 1);
|
||||
siglongjmp (pingTime, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -980,7 +980,7 @@ PingServer( void )
|
|||
oldAlarm = alarm (0);
|
||||
oldSig = signal (SIGALRM, PingBlocked);
|
||||
alarm (pingTimeout * 60);
|
||||
if (!setjmp (pingTime))
|
||||
if (!sigsetjmp (pingTime, 1))
|
||||
{
|
||||
XSync (dpyinfo.dpy, 0);
|
||||
}
|
||||
|
|
|
@ -671,13 +671,13 @@ main( int argc, char **argv )
|
|||
|
||||
#define MINTIMEOUT 20
|
||||
|
||||
static jmp_buf syncJump;
|
||||
static sigjmp_buf syncJump;
|
||||
|
||||
static SIGVAL
|
||||
syncTimeout( int arg )
|
||||
|
||||
{
|
||||
longjmp (syncJump, 1);
|
||||
siglongjmp (syncJump, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -707,7 +707,7 @@ InitToolKit( int argc, char **argv )
|
|||
*/
|
||||
|
||||
signal (SIGALRM, syncTimeout);
|
||||
if (setjmp (syncJump)) {
|
||||
if (sigsetjmp (syncJump, 1)) {
|
||||
LogError(
|
||||
ReadCatalog(MC_LOG_SET,MC_LOG_NO_DPYINIT,MC_DEF_LOG_NO_DPYINIT),
|
||||
dpyinfo.name);
|
||||
|
|
|
@ -824,14 +824,14 @@ ReadCatalogXms(int setn, int msgn, char *dflt)
|
|||
* grab/release the server and keyboard
|
||||
***************************************************************************/
|
||||
|
||||
static jmp_buf syncJump;
|
||||
static sigjmp_buf syncJump;
|
||||
static int grabServer; /* Boolean on grabbing server */
|
||||
static int grabTimeout; /* timeout to grab server */
|
||||
|
||||
static SIGVAL
|
||||
syncTimeout( int arg )
|
||||
{
|
||||
longjmp (syncJump, 1);
|
||||
siglongjmp (syncJump, 1);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -853,7 +853,7 @@ SecureDisplay( void )
|
|||
* grab server then the keyboard...
|
||||
*/
|
||||
signal (SIGALRM, syncTimeout);
|
||||
if (setjmp (syncJump)) {
|
||||
if (sigsetjmp (syncJump, 1)) {
|
||||
LogError(ReadCatalog(MC_LOG_SET,MC_LOG_NO_SECDPY,MC_DEF_LOG_NO_SECDPY),
|
||||
dpyinfo.name);
|
||||
return(1);
|
||||
|
|
Loading…
Reference in a new issue