summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2015-10-22 10:57:57 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2015-10-22 22:46:10 +0200
commit8be60e6a65baf87b12862e07d24bd794608df2f2 (patch)
treeec33e03a08038060a0c17a4afbaf9616d66bf673
parent39cffa4e9b027162430ea7f3c288256b232a1ed7 (diff)
downloadlvm2-8be60e6a65baf87b12862e07d24bd794608df2f2.tar.gz
cleanup: easier to read code
Avoid using #ifdef code and use 'cmd' instead of 'die'.
-rw-r--r--daemons/dmeventd/dmeventd.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 606ef3086..9662c0ef2 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1590,11 +1590,8 @@ static int _do_process_request(struct dm_event_daemon_message *msg)
/* Only one caller at a time. */
static void _process_request(struct dm_event_fifos *fifos)
{
- int die;
struct dm_event_daemon_message msg = { 0 };
-#ifdef DEBUG
int cmd;
-#endif
/*
* Read the request from the client (client_read, client_write
* give true on success and false on failure).
@@ -1602,12 +1599,9 @@ static void _process_request(struct dm_event_fifos *fifos)
if (!_client_read(fifos, &msg))
return;
-#ifdef DEBUG
cmd = msg.cmd;
-#endif
- DEBUGLOG(">>> CMD:%s (0x%x) processing...", decode_cmd(cmd), cmd);
- die = (msg.cmd == DM_EVENT_CMD_DIE) ? 1 : 0;
+ DEBUGLOG(">>> CMD:%s (0x%x) processing...", decode_cmd(cmd), cmd);
/* _do_process_request fills in msg (if memory allows for
data, otherwise just cmd and size = 0) */
@@ -1616,11 +1610,11 @@ static void _process_request(struct dm_event_fifos *fifos)
if (!_client_write(fifos, &msg))
stack;
- dm_free(msg.data);
+ DEBUGLOG("<<< CMD:%s (0x%x) completed (result %d).", decode_cmd(cmd), cmd, msg.cmd);
- DEBUGLOG("<<< CMD:%s (0x%x) completed (=%d).", decode_cmd(cmd), cmd, msg.cmd);
+ dm_free(msg.data);
- if (die) {
+ if (cmd == DM_EVENT_CMD_DIE) {
if (unlink(DMEVENTD_PIDFILE))
log_sys_error("unlink", DMEVENTD_PIDFILE);
_exit(0);