return true;
/* Detect whether we should send SIGRTMIN + 3 (e.g. systemd). */
- if (task_blocking_signal(pid, (SIGRTMIN + 3)))
- haltsignal = (SIGRTMIN + 3);
-
if (c->lxc_conf && c->lxc_conf->haltsignal)
haltsignal = c->lxc_conf->haltsignal;
+ else if (task_blocking_signal(pid, (SIGRTMIN + 3)))
+ haltsignal = (SIGRTMIN + 3);
/* Add a new state client before sending the shutdown signal so that we
* don't miss a state.
/* Check whether a signal is blocked by a process. */
/* /proc/pid-to-str/status\0 = (5 + 21 + 7 + 1) */
-#define __PROC_STATUS_LEN (5 + (LXC_NUMSTRLEN64) + 7 + 1)
+#define __PROC_STATUS_LEN (6 + (LXC_NUMSTRLEN64) + 7 + 1)
bool task_blocking_signal(pid_t pid, int signal)
{
- bool bret = false;
- char *line = NULL;
- long unsigned int sigblk = 0;
- size_t n = 0;
int ret;
- FILE *f;
-
char status[__PROC_STATUS_LEN];
+ FILE *f;
+ long unsigned int sigblk = 0;
+ size_t n = 0;
+ bool bret = false;
+ char *line = NULL;
ret = snprintf(status, __PROC_STATUS_LEN, "/proc/%d/status", pid);
if (ret < 0 || ret >= __PROC_STATUS_LEN)
return bret;
while (getline(&line, &n, f) != -1) {
- if (strncmp(line, "SigBlk:\t", 8))
+ if (strncmp(line, "SigBlk:", 7))
continue;
- if (sscanf(line + 8, "%lx", &sigblk) != 1)
+ if (sscanf(line + 7, "%lx", &sigblk) != 1)
goto out;
}