Minor refactor
- Check all pointers
- Declaratons always at top of func/scope
- Use established variable nomenclature
- Skip useless if() stmt
@@ -116,17 +116,13 @@ static int do_reload (char *buf, size_t len) { return call(reload, buf, len); }
static int do_signal_svc(svc_t *svc, void *user_data)
{
- if (!svc)
- return 1;
+ int signo;
- if (!svc_is_running(svc))
+ if (!svc || !user_data || !svc_is_running(svc))
return 1;
- int sig = *(int *)user_data;
- if (kill(svc->pid, sig))
- return 1;
-
- return 0;
+ signo = *(int *)user_data;
+ return !!kill(svc->pid, signo);
}
static int do_signal(char *buf, size_t len, int sig)
