summaryrefslogtreecommitdiffstats
path: root/lib/loopdev.c
diff options
context:
space:
mode:
authorKarel Zak2012-04-02 17:33:34 +0200
committerKarel Zak2012-04-02 17:33:41 +0200
commit6219c25ecbaf07c4e8c44e24bcc74428b5ec7bf1 (patch)
treebbec664167f8826206d4a0e7f029e86b06027950 /lib/loopdev.c
parentrtcwake: tiny coding style change (diff)
downloadkernel-qcow2-util-linux-6219c25ecbaf07c4e8c44e24bcc74428b5ec7bf1.tar.gz
kernel-qcow2-util-linux-6219c25ecbaf07c4e8c44e24bcc74428b5ec7bf1.tar.xz
kernel-qcow2-util-linux-6219c25ecbaf07c4e8c44e24bcc74428b5ec7bf1.zip
lib/loopdev: more robust initialization
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib/loopdev.c')
-rw-r--r--lib/loopdev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/loopdev.c b/lib/loopdev.c
index f917f187c..fd3f9bae5 100644
--- a/lib/loopdev.c
+++ b/lib/loopdev.c
@@ -144,11 +144,12 @@ int loopcxt_has_device(struct loopdev_cxt *lc)
int loopcxt_init(struct loopdev_cxt *lc, int flags)
{
struct stat st;
+ struct loopdev_cxt dummy = UL_LOOPDEVCXT_EMPTY;
if (!lc)
return -EINVAL;
- memset(lc, 0, sizeof(*lc));
+ memcpy(lc, &dummy, sizeof(dummy));
lc->flags = flags;
loopcxt_set_device(lc, NULL);