]> Dogcows Code - chaz/openbox/commitdiff
make ob_exit() take an error code. don't exit with 0 for signals other than TERM...
authorDana Jansens <danakj@orodu.net>
Wed, 17 Sep 2003 02:50:20 +0000 (02:50 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 17 Sep 2003 02:50:20 +0000 (02:50 +0000)
openbox/action.c
openbox/event.c
openbox/openbox.c
openbox/openbox.h
openbox/session.c

index adfa2d9e6c8957caddbcc58d0d9e838fbe3b02f6..d394b95b793a6b9c3d6a506b81a7d54bbc1ed3ce 100644 (file)
@@ -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)
index e566f01f0c74d348936c70a99ffcd8fc5be6bcea..d1c27fd750c24d9e5002a2a520ca177e60cd1308 100644 (file)
@@ -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:
index 73cc6e77821e8ce55323bfffe948521412ff2781..5b7e8e7e69c3090615ffe3dd233256d1c2599803 100644 (file)
@@ -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);
 }
 
index a4e87a3a3d76eb88f8e491ba59a569128c9fc3bb..4e7bd818a5f626bf180fe25bd39a37006aae52b8 100644 (file)
@@ -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();
 
index 9ce04674eae453afdcbd65c08780aa91f2681339..f646da0817ba3a1e67b00b95d6c2b53cfce90bc3 100644 (file)
@@ -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)
This page took 0.029155 seconds and 4 git commands to generate.