make ob_exit() take an error code. don't exit with 0 for signals other than TERM and INT.
This commit is contained in:
parent
275c44c386
commit
f85a855417
5 changed files with 12 additions and 9 deletions
|
@ -1167,7 +1167,7 @@ void action_restart(union ActionData *data)
|
|||
|
||||
void action_exit(union ActionData *data)
|
||||
{
|
||||
ob_exit();
|
||||
ob_exit(0);
|
||||
}
|
||||
|
||||
void action_showmenu(union ActionData *data)
|
||||
|
|
|
@ -554,7 +554,7 @@ static void event_handle_root(XEvent *e)
|
|||
switch(e->type) {
|
||||
case SelectionClear:
|
||||
ob_debug("Another WM has requested to replace us. Exiting.\n");
|
||||
ob_exit();
|
||||
ob_exit(0);
|
||||
break;
|
||||
|
||||
case ClientMessage:
|
||||
|
|
|
@ -61,6 +61,7 @@ static gboolean restart;
|
|||
static char *restart_path;
|
||||
static Cursor cursors[OB_NUM_CURSORS];
|
||||
static KeyCode keys[OB_NUM_KEYS];
|
||||
static gint exitcode = 0;
|
||||
|
||||
static void signal_handler(int signal, gpointer data);
|
||||
static void parse_args(int argc, char **argv);
|
||||
|
@ -297,7 +298,7 @@ int main(int argc, char **argv)
|
|||
execlp(argv[0], g_path_get_basename(argv[0])); /* last resort */
|
||||
}
|
||||
|
||||
return 0;
|
||||
return exitcode;
|
||||
}
|
||||
|
||||
static void signal_handler(int signal, gpointer data)
|
||||
|
@ -310,7 +311,8 @@ static void signal_handler(int signal, gpointer data)
|
|||
ob_reconfigure();
|
||||
} else {
|
||||
fprintf(stderr, "Caught signal %d. Exiting.\n", signal);
|
||||
ob_exit();
|
||||
/* TERM and INT return a 0 code */
|
||||
ob_exit(!(signal == SIGTERM || signal == SIGINT));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,17 +388,18 @@ void ob_restart_other(const gchar *path)
|
|||
void ob_restart()
|
||||
{
|
||||
restart = TRUE;
|
||||
ob_exit();
|
||||
ob_exit(0);
|
||||
}
|
||||
|
||||
void ob_reconfigure()
|
||||
{
|
||||
reconfigure = TRUE;
|
||||
ob_exit();
|
||||
ob_exit(0);
|
||||
}
|
||||
|
||||
void ob_exit()
|
||||
void ob_exit(gint code)
|
||||
{
|
||||
exitcode = code;
|
||||
ob_main_loop_exit(ob_main_loop);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ ObState ob_state();
|
|||
|
||||
void ob_restart_other(const gchar *path);
|
||||
void ob_restart();
|
||||
void ob_exit();
|
||||
void ob_exit(gint code);
|
||||
|
||||
void ob_reconfigure();
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ static void sm_save_yourself(SmcConn conn, SmPointer data, int save_type,
|
|||
|
||||
static void sm_die(SmcConn conn, SmPointer data)
|
||||
{
|
||||
ob_exit();
|
||||
ob_exit(0);
|
||||
}
|
||||
|
||||
static void sm_save_complete(SmcConn conn, SmPointer data)
|
||||
|
|
Loading…
Reference in a new issue