diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-12-19 20:07:23 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-12-19 20:07:23 +0100 |
commit | c2ce6a3d82b717c4c1e6245ad8c6ce1173f502d0 (patch) | |
tree | c76b52cfb0c996f8175c447f06ff5c44963eb708 /src/shared | |
parent | 821d4b6e068b2afaad94d43db22171c34a30400e (diff) |
machined: add new GetImage() bus call for retrieving the bus path for an image
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/util.c | 17 | ||||
-rw-r--r-- | src/shared/util.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 1ad82b27dd..06b6077843 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -4257,6 +4257,23 @@ bool machine_name_is_valid(const char *s) { return true; } +bool image_name_is_valid(const char *s) { + if (!filename_is_valid(s)) + return false; + + if (string_has_cc(s, NULL)) + return false; + + if (!utf8_is_valid(s)) + return false; + + /* Temporary files for atomically creating new files */ + if (startswith(s, ".#")) + return false; + + return true; +} + int pipe_eof(int fd) { struct pollfd pollfd = { .fd = fd, diff --git a/src/shared/util.h b/src/shared/util.h index 712f65a957..1804b8c3a2 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -545,6 +545,7 @@ bool hostname_is_valid(const char *s) _pure_; char* hostname_cleanup(char *s, bool lowercase); bool machine_name_is_valid(const char *s) _pure_; +bool image_name_is_valid(const char *s) _pure_; char* strshorten(char *s, size_t l); |