Unverified Commit f14bc249 by Serge Hallyn Committed by Christian Brauner

dir_detect: warn on eperm

if user has lxc.rootfs.path = /some/path/foo, but can't access some piece of that path, then we'll get an unhelpful "failed to mount" without any indication of the problem. At least show that there is a permission problem. Signed-off-by: 's avatarSerge Hallyn <shallyn@cisco.com>
parent 93b20b93
...@@ -136,10 +136,19 @@ int dir_destroy(struct lxc_storage *orig) ...@@ -136,10 +136,19 @@ int dir_destroy(struct lxc_storage *orig)
bool dir_detect(const char *path) bool dir_detect(const char *path)
{ {
struct stat statbuf;
int ret;
if (!strncmp(path, "dir:", 4)) if (!strncmp(path, "dir:", 4))
return true; return true;
if (is_dir(path)) ret = stat(path, &statbuf);
if (ret == -1 && errno == EPERM) {
SYSERROR("dir_detect: failed to look at \"%s\"", path);
return false;
}
if (ret == 0 && S_ISDIR(statbuf.st_mode))
return true; return true;
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment