diff options
author | Stefan Junker <code@stefanjunker.de> | 2015-05-14 22:51:05 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-03-14 09:56:08 +0100 |
commit | 9d71c4569fbf7068a3a7d7b2a4cf8f05fe5eb067 (patch) | |
tree | 8fe2714b9818990e582c6be6ac6df3421558f931 /src/shared/util.c | |
parent | ae4d8a53917f93608a61831f4733520bbe36b124 (diff) |
nspawn: allow access to device nodes listed in --bind= and --bind-ro= switches
https://bugs.freedesktop.org/show_bug.cgi?id=90385
Diffstat (limited to 'src/shared/util.c')
-rw-r--r-- | src/shared/util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 9b67dd829..d7a5b2094 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -5436,6 +5436,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; |