diff options
author | Timofey Titovets <nefelim4ag@gmail.com> | 2014-08-15 02:05:47 +0300 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-08-15 01:35:28 +0200 |
commit | 5261ba901845c084de5a8fd06500ed09bfb0bd80 (patch) | |
tree | af5f9a6d0606bd05fe0b1fe95a7e9354957f29b9 /src/shared | |
parent | 1bd27a45d04639190fc91ad2552b72ea759c0c27 (diff) |
core: Refuse mount on symlink
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/util.c | 12 | ||||
-rw-r--r-- | src/shared/util.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 3d16cd1a13..0db4bd90e8 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -6918,3 +6918,15 @@ int take_password_lock(const char *root) { return fd; } + +int is_symlink(const char *path) { + struct stat info; + + if (lstat(path, &info) < 0) + return -errno; + + if (S_ISLNK(info.st_mode)) + return 1; + + return 0; +}
\ No newline at end of file diff --git a/src/shared/util.h b/src/shared/util.h index 101d2dfcf8..bd8bbb268f 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -966,3 +966,5 @@ char *tempfn_random(const char *p); bool is_localhost(const char *hostname); int take_password_lock(const char *root); + +int is_symlink(const char *path);
\ No newline at end of file |