return -ETIMEDOUT;
}
+ errno = 0;
if (!fgets(line, sizeof(line), f))
- return -EIO;
+ return errno ? -errno : -EIO;
truncate_nl(line);
return s;
}
+bool machine_name_is_valid(const char *s) {
+
+ if (!hostname_is_valid(s))
+ return false;
+
+ /* Machine names should be useful hostnames, but also be
+ * useful in unit names, hence we enforce a stricter length
+ * limitation. */
+
+ if (strlen(s) > 64)
+ return false;
+
+ return true;
+}
+
int pipe_eof(int fd) {
struct pollfd pollfd = {
.fd = fd,
if (*t > 0 && *t < ' ')
return false;
+ if (*t == 127)
+ return false;
+
if (strchr("\\\"\'", *t))
return false;
}
assert(p);
- for (t = p; *t; t++)
+ for (t = p; *t; t++) {
if (*t > 0 && *t < ' ' && *t != '\t')
return true;
+ if (*t == 127)
+ return true;
+ }
+
return false;
}