1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 20:25:25 +03:00

logind: check file is device node before using .st_rdev

This commit is contained in:
Lennart Poettering 2018-02-26 18:34:43 +01:00
parent 0410444446
commit 51ead3e377

View File

@ -453,6 +453,12 @@ static int manager_attach_fds(Manager *m) {
continue;
}
if (!S_ISCHR(st.st_mode) && !S_ISBLK(st.st_mode)) {
log_debug("Device fd doesn't actually point to device node: %m");
close_nointr(fd);
continue;
}
sd = hashmap_get(s->devices, &st.st_rdev);
if (!sd) {
/* Weird, we got an fd for a session device which wasn't