util-lib: move fdname_is_valid() to fd-util.[ch]

This commit is contained in:
Lennart Poettering
2015-10-27 14:57:44 +01:00
parent 3f2c0becc3
commit 4fee397531
4 changed files with 29 additions and 29 deletions
-27
View File
@@ -838,30 +838,3 @@ int version(void) {
SYSTEMD_FEATURES);
return 0;
}
bool fdname_is_valid(const char *s) {
const char *p;
/* Validates a name for $LISTEN_FDNAMES. We basically allow
* everything ASCII that's not a control character. Also, as
* special exception the ":" character is not allowed, as we
* use that as field separator in $LISTEN_FDNAMES.
*
* Note that the empty string is explicitly allowed
* here. However, we limit the length of the names to 255
* characters. */
if (!s)
return false;
for (p = s; *p; p++) {
if (*p < ' ')
return false;
if (*p >= 127)
return false;
if (*p == ':')
return false;
}
return p - s < 256;
}