Merge pull request #1468 from poettering/fdnames

Add support for naming fds for socket activation and more
This commit is contained in:
Tom Gundersen
2015-10-06 12:06:56 +02:00
29 changed files with 700 additions and 202 deletions
+25
View File
@@ -6845,3 +6845,28 @@ int version(void) {
SYSTEMD_FEATURES);
return 0;
}
bool fdname_is_valid(const char *s) {
const char *p;
/* Validates a name for $LISTEN_NAMES. 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_NAMES.
*
* Note that the empty string is explicitly allowed here.*/
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;
}