diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2012-06-21 21:19:28 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2012-06-22 13:23:03 +0200 |
commit | 6f3cd63551db013e3cf5dfcebc41115322d5cfe9 (patch) | |
tree | 0dc6d844cc137cb3e665f79ac78ead4db12bd697 /daemons/cmirrord | |
parent | da42ee3a1f0280742e87a96f5d0694fb869a23e0 (diff) | |
download | lvm2-6f3cd63551db013e3cf5dfcebc41115322d5cfe9.tar.gz |
cleanup: replace memset with struct initilization
Simplifies the code, properly detects too long socket paths,
drops unused parameter.
Diffstat (limited to 'daemons/cmirrord')
-rw-r--r-- | daemons/cmirrord/cluster.c | 3 | ||||
-rw-r--r-- | daemons/cmirrord/functions.c | 8 |
2 files changed, 3 insertions, 8 deletions
diff --git a/daemons/cmirrord/cluster.c b/daemons/cmirrord/cluster.c index 9fbf8007b..70c76c3ae 100644 --- a/daemons/cmirrord/cluster.c +++ b/daemons/cmirrord/cluster.c @@ -1249,7 +1249,7 @@ static void cpg_join_callback(struct clog_cpg *match, uint32_t my_pid = (uint32_t)getpid(); uint32_t lowest = match->lowest_id; struct clog_request *rq; - char dbuf[32]; + char dbuf[32] = { 0 }; /* Assign my_cluster_id */ if ((my_cluster_id == 0xDEAD) && (joined->pid == my_pid)) @@ -1265,7 +1265,6 @@ static void cpg_join_callback(struct clog_cpg *match, if (joined->nodeid == my_cluster_id) goto out; - memset(dbuf, 0, sizeof(dbuf)); for (i = 0; i < member_list_entries - 1; i++) sprintf(dbuf+strlen(dbuf), "%u-", member_list[i].nodeid); sprintf(dbuf+strlen(dbuf), "(%u)", joined->nodeid); diff --git a/daemons/cmirrord/functions.c b/daemons/cmirrord/functions.c index 3e8fd2029..f6e09180d 100644 --- a/daemons/cmirrord/functions.c +++ b/daemons/cmirrord/functions.c @@ -235,11 +235,9 @@ static int rw_log(struct log_c *lc, int do_write) */ static int read_log(struct log_c *lc) { - struct log_header lh; + struct log_header lh = { 0 }; size_t bitset_size; - memset(&lh, 0, sizeof(struct log_header)); - if (rw_log(lc, 0)) return -EIO; /* Failed disk read */ @@ -1724,14 +1722,12 @@ int do_request(struct clog_request *rq, int server) static void print_bits(dm_bitset_t bs, int print) { int i, size; - char outbuf[128]; + char outbuf[128] = { 0 }; unsigned char *buf = (unsigned char *)(bs + 1); size = (*bs % 8) ? 1 : 0; size += (*bs / 8); - memset(outbuf, 0, sizeof(outbuf)); - for (i = 0; i < size; i++) { if (!(i % 16)) { if (outbuf[0] != '\0') { |