[lxc-devel] [lxc/stable-1.0] bdev: enable building with gcc7
brauner on Github
lxc-bot at linuxcontainers.org
Tue Aug 15 22:35:21 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 400 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170815/978989e6/attachment.bin>
-------------- next part --------------
From 24fdb3f00807683a553225921b0c4d8f23c274e0 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 16 Aug 2017 00:34:23 +0200
Subject: [PATCH] bdev: enable building with gcc7
We shouldn't ignore this anyway.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/bdev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
index 1f1fd66a6..73b682f4c 100644
--- a/src/lxc/bdev.c
+++ b/src/lxc/bdev.c
@@ -1930,7 +1930,11 @@ static int find_free_loopdev_no_control(int *retfd, char *namep)
continue;
}
// We can use this fd
- snprintf(namep, 100, "/dev/%s", direntp->d_name);
+ ret = snprintf(namep, 100, "/dev/%s", direntp->d_name);
+ if (ret < 0 || ret >= 100) {
+ close(fd);
+ fd = -1;
+ }
break;
}
closedir(dir);
More information about the lxc-devel
mailing list