Browse Source

eloop: Signal handler can be reassigned

Serj Kalichev 6 months ago
parent
commit
8780179d84
1 changed files with 5 additions and 2 deletions
  1. 5 2
      faux/eloop/eloop.c

+ 5 - 2
faux/eloop/eloop.c

@@ -606,8 +606,11 @@ bool_t faux_eloop_add_signal(faux_eloop_t *eloop, int signo,
 	if (!eloop || (signo < 0))
 		return BOOL_FALSE;
 
-	if (sigismember(&eloop->sig_set, signo) == 1)
-		return BOOL_FALSE; // Already exists
+	if (sigismember(&eloop->sig_set, signo) == 1) { // Already exists
+		// Signal must be reassigned. So remove previous one
+		if (!faux_eloop_del_signal(eloop, signo))
+			return BOOL_FALSE;
+	}
 
 	// Firstly try to add signal to sigset. Library function will validate
 	// signal number value.