From ce5b3ad4508fa6d561fcccff0852afaace1d82ac Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Thu, 14 May 2015 22:51:05 +0200 Subject: nspawn: allow access to device nodes listed in --bind= and --bind-ro= switches https://bugs.freedesktop.org/show_bug.cgi?id=90385 --- src/shared/util.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/shared/util.c') diff --git a/src/shared/util.c b/src/shared/util.c index 72711e133a..dda88bd2ee 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -5435,6 +5435,15 @@ int is_dir(const char* path, bool follow) { return !!S_ISDIR(st.st_mode); } +int is_device_node(const char *path) { + struct stat info; + + if (lstat(path, &info) < 0) + return -errno; + + return !!(S_ISBLK(info.st_mode) || S_ISCHR(info.st_mode)); +} + int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) { _cleanup_free_ char *s = NULL; size_t allocated = 0, sz = 0; -- cgit v1.2.3-54-g00ecf