summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-19 20:07:23 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-19 20:07:23 +0100
commitc2ce6a3d82b717c4c1e6245ad8c6ce1173f502d0 (patch)
treec76b52cfb0c996f8175c447f06ff5c44963eb708 /src/shared/util.c
parent821d4b6e068b2afaad94d43db22171c34a30400e (diff)
machined: add new GetImage() bus call for retrieving the bus path for an image
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c17
1 files changed, 17 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,