Browse Source

apps: signal usage cleanup

K. Lange 2 years ago
parent
commit
fea6693410
8 changed files with 7 additions and 8 deletions
  1. 1 0
      apps/background.c
  2. 1 0
      apps/compositor.c
  3. 0 1
      apps/live-session.c
  4. 2 0
      apps/panel.c
  5. 0 2
      apps/pidof.c
  6. 0 1
      apps/serial-console.c
  7. 3 3
      apps/sh.c
  8. 0 1
      apps/sudo.c

+ 1 - 0
apps/background.c

@@ -89,6 +89,7 @@ static void check_click(struct yutani_msg_window_mouse_event * evt) {
 static void sig_usr2(int sig) {
 	yutani_set_stack(yctx, wallpaper_window, YUTANI_ZORDER_BOTTOM);
 	yutani_flip(yctx, wallpaper_window);
+	signal(SIGUSR2, sig_usr2);
 }
 
 int main (int argc, char ** argv) {

+ 1 - 0
apps/compositor.c

@@ -1999,6 +1999,7 @@ static void yutani_display_resize_handle(int signum) {
 	(void)signum;
 	TRACE("Display change request, one moment.");
 	_static_yg->resize_on_next = 1;
+	signal(SIGWINEVENT, yutani_display_resize_handle);
 }
 
 /**

+ 0 - 1
apps/live-session.c

@@ -11,7 +11,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
-#include <signal.h>
 #include <errno.h>
 #include <sys/wait.h>
 #include <toaru/auth.h>

+ 2 - 0
apps/panel.c

@@ -193,6 +193,7 @@ static void toggle_hide_panel(void) {
 static void sig_int(int sig) {
 	printf("Received shutdown signal in panel!\n");
 	_continue = 0;
+	signal(SIGINT, sig_int);
 }
 
 static void launch_application(char * app) {
@@ -1111,6 +1112,7 @@ static void sig_usr2(int sig) {
 	yutani_set_stack(yctx, panel, YUTANI_ZORDER_TOP);
 	yutani_flip(yctx, panel);
 	bind_keys();
+	signal(SIGUSR2, sig_usr2);
 }
 
 int main (int argc, char ** argv) {

+ 0 - 2
apps/pidof.c

@@ -7,7 +7,6 @@
  *
  */
 #include <sys/stat.h>
-#include <sys/signal.h>
 #include <fcntl.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -15,7 +14,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <dirent.h>
-#include <signal.h>
 
 typedef struct process {
 	int pid;

+ 0 - 1
apps/serial-console.c

@@ -12,7 +12,6 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <signal.h>
 #include <string.h>
 #include <termios.h>
 #include <fcntl.h>

+ 3 - 3
apps/sh.c

@@ -350,9 +350,10 @@ volatile int break_while = 0;
 pid_t suspended_pgid = 0;
 hashmap_t * job_hash = NULL;
 
-void sig_pass(int sig) {
+void sig_break_loop(int sig) {
 	/* Interrupt handler */
 	break_while = sig;
+	signal(sig, sig_break_loop);
 }
 
 void redraw_prompt_func(rline_context_t * context) {
@@ -1500,8 +1501,7 @@ int main(int argc, char ** argv) {
 
 	pid = getpid();
 
-	signal(SIGINT, sig_pass);
-	signal(SIGWINCH, sig_pass);
+	signal(SIGINT, sig_break_loop);
 
 	job_hash = hashmap_create_int(10);
 

+ 0 - 1
apps/sudo.c

@@ -13,7 +13,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <time.h>
-#include <signal.h>
 #include <termios.h>
 #include <errno.h>
 #include <pwd.h>