}
// These macros are used in functions below
-#define SNPRINTF_OR_EXIT_W(name, format, member) if (snprintf(name##_str, sizeof(name##_str), format, cinfo->member) < 0) goto out;
+#define SNPRINTF_OR_EXIT_W(name, format, member) do { if (snprintf(name##_str, sizeof(name##_str), format, cinfo->member) < 0) goto out; } while (0)
#define SNPRINTF_OR_EXIT(name, format) SNPRINTF_OR_EXIT_W(name, format, name##_info)
static bool extra_script(const struct crash_info *cinfo, pid_t *pid)
return false;
char pid_str[11];
- SNPRINTF_OR_EXIT(pid, "%d")
+ SNPRINTF_OR_EXIT(pid, "%d");
char *av[] = { config.extra_script, cinfo->pfx, pid_str, NULL };
spawn_param_s param = { .fn = spawn_setstdout, .u.int_val = STDERR_FILENO };
return;
}
- SNPRINTF_OR_EXIT(pid, "%d")
- SNPRINTF_OR_EXIT(tid, "%d")
- SNPRINTF_OR_EXIT(sig, "%d")
+ SNPRINTF_OR_EXIT(pid, "%d");
+ SNPRINTF_OR_EXIT(tid, "%d");
+ SNPRINTF_OR_EXIT(sig, "%d");
char *av[] = { CRASH_NOTIFY_BIN_PATH,
"--cmdline", cinfo->cmd_line,
char pid_str[11], uid_str[11], gid_str[11], sig_str[11], time_str[11];
- SNPRINTF_OR_EXIT(pid, "%d")
- SNPRINTF_OR_EXIT(uid, "%d")
- SNPRINTF_OR_EXIT(gid, "%d")
- SNPRINTF_OR_EXIT(sig, "%d")
- SNPRINTF_OR_EXIT(time, "%ld")
+ SNPRINTF_OR_EXIT(pid, "%d");
+ SNPRINTF_OR_EXIT(uid, "%d");
+ SNPRINTF_OR_EXIT(gid, "%d");
+ SNPRINTF_OR_EXIT(sig, "%d");
+ SNPRINTF_OR_EXIT(time, "%ld");
/* Execute minicoredumper */
char *args[] = {
goto out;
}
- SNPRINTF_OR_EXIT(pid, "%d")
+ SNPRINTF_OR_EXIT(pid, "%d");
/* Execute livedumper */
char *args[] = {
char pid_str[11], tid_str[11], sig_str[11], prstatus_fd_str[11];
bool is_ok = false;
- SNPRINTF_OR_EXIT(pid, "%d")
- SNPRINTF_OR_EXIT(tid, "%d")
- SNPRINTF_OR_EXIT(sig, "%d")
- SNPRINTF_OR_EXIT_W(prstatus_fd, "%d", prstatus_fd)
+ SNPRINTF_OR_EXIT(pid, "%d");
+ SNPRINTF_OR_EXIT(tid, "%d");
+ SNPRINTF_OR_EXIT(sig, "%d");
+ SNPRINTF_OR_EXIT_W(prstatus_fd, "%d", prstatus_fd);
/* Execute crash-stack */
char *args[] = { CRASH_STACK_BIN_PATH,