summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Lewandowski <k.lewandowsk@samsung.com>2019-09-28 18:28:01 +0200
committerKarol Lewandowski <k.lewandowsk@samsung.com>2019-09-28 18:28:01 +0200
commit766b8791820c94ff8cff56bfa5f6a953ce9c9f57 (patch)
tree63b8a2627c5a8bbabf161d9077d65fbf0759c3e3
parentd70d319d3809e38e0c6e42c40944aaf57ce26975 (diff)
downloadcrash-worker-766b8791820c94ff8cff56bfa5f6a953ce9c9f57.tar.gz
crash-worker-766b8791820c94ff8cff56bfa5f6a953ce9c9f57.tar.bz2
crash-worker-766b8791820c94ff8cff56bfa5f6a953ce9c9f57.zip
Make remaining macros behave like standard statements
Change-Id: Id09a320422eeac2ddd459b47b023df8d4d975971
-rw-r--r--src/crash-manager/crash-manager.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/crash-manager/crash-manager.c b/src/crash-manager/crash-manager.c
index dd2bab1..821d516 100644
--- a/src/crash-manager/crash-manager.c
+++ b/src/crash-manager/crash-manager.c
@@ -534,7 +534,7 @@ end:
}
// 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)
@@ -543,7 +543,7 @@ 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 };
@@ -568,9 +568,9 @@ static void launch_dbus_notify(struct crash_info *cinfo)
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,
@@ -604,11 +604,11 @@ static bool execute_minicoredump(struct crash_info *cinfo, int *exit_code)
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[] = {
@@ -664,7 +664,7 @@ static bool execute_livedumper(const struct crash_info *cinfo, int *exit_code)
goto out;
}
- SNPRINTF_OR_EXIT(pid, "%d")
+ SNPRINTF_OR_EXIT(pid, "%d");
/* Execute livedumper */
char *args[] = {
@@ -689,10 +689,10 @@ static bool execute_crash_stack(const struct crash_info *cinfo, int *exit_code)
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,