* properly handle .mount unit state tracking when two mount points are stacked one on top of another on the exact same mount point.
Features:
+
+* Add pretty name for seats in logind
+
* nspawn wants dev_setup() for /dev/fd/ and friends?
* selinux: merge systemd selinux access controls (dwalsh)
case CONDITION_PATH_IS_MOUNT_POINT:
return (path_is_mount_point(c->parameter, true) > 0) == !c->negate;
- case CONDITION_PATH_IS_READ_WRITE: {
- struct statvfs st;
-
- if (statvfs(c->parameter, &st) < 0)
- return c->negate;
-
- return !(st.f_flag & ST_RDONLY) == !c->negate;
- }
+ case CONDITION_PATH_IS_READ_WRITE:
+ return (path_is_read_only_fs(c->parameter) > 0) == c->negate;
case CONDITION_DIRECTORY_NOT_EMPTY: {
int k;
#include <glob.h>
#include <grp.h>
#include <sys/mman.h>
+#include <sys/statvfs.h>
#include "macro.h"
#include "util.h"
if (startswith(tty, "/dev/"))
tty += 5;
- /* Resolve where /dev/console is pointing to */
- if (streq(tty, "console"))
+ /* Resolve where /dev/console is pointing to, if /sys is
+ * actually ours (i.e. not read-only-mounted which is a sign
+ * for container setups) */
+ if (streq(tty, "console") && path_is_read_only_fs("/sys") <= 0)
if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {
/* If multiple log outputs are configured the
* last one is what /dev/console points to */
return 0;
}
+
+int path_is_read_only_fs(const char *path) {
+ struct statvfs st;
+
+ assert(path);
+
+ if (statvfs(path, &st) < 0)
+ return -errno;
+
+ return !!(st.f_flag & ST_RDONLY);
+}
ssize_t loop_write(int fd, const void *buf, size_t nbytes, bool do_poll);
int path_is_mount_point(const char *path, bool allow_symlink);
+int path_is_read_only_fs(const char *path);
bool is_device_path(const char *path);