diff options
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); |