rootfs_is_blockdev: don't run if no rootfs is specified

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Serge Hallyn 2014-07-14 13:22:53 -05:00
parent cd62fd869c
commit acf9f89e61

View File

@ -3123,6 +3123,10 @@ bool rootfs_is_blockdev(struct lxc_conf *conf)
struct stat st;
int ret;
if (!conf->rootfs.path || strcmp(conf->rootfs.path, "/") == 0 ||
strlen(conf->rootfs.path) == 0)
return false;
ret = stat(conf->rootfs.path, &st);
if (ret == 0 && S_ISBLK(st.st_mode))
return true;