summaryrefslogtreecommitdiffstats
path: root/daemons/cmirrord/functions.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2012-06-21 21:19:28 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2012-06-22 13:23:03 +0200
commit6f3cd63551db013e3cf5dfcebc41115322d5cfe9 (patch)
tree0dc6d844cc137cb3e665f79ac78ead4db12bd697 /daemons/cmirrord/functions.c
parentda42ee3a1f0280742e87a96f5d0694fb869a23e0 (diff)
downloadlvm2-6f3cd63551db013e3cf5dfcebc41115322d5cfe9.tar.gz
lvm2-6f3cd63551db013e3cf5dfcebc41115322d5cfe9.tar.xz
lvm2-6f3cd63551db013e3cf5dfcebc41115322d5cfe9.zip
cleanup: replace memset with struct initilization
Simplifies the code, properly detects too long socket paths, drops unused parameter.
Diffstat (limited to 'daemons/cmirrord/functions.c')
-rw-r--r--daemons/cmirrord/functions.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/daemons/cmirrord/functions.c b/daemons/cmirrord/functions.c
index 3e8fd202..f6e09180 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') {