diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-02-26 18:34:43 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-05-30 07:59:06 +0200 |
commit | fb52e9446e570146735876aa9b38e617316ea36f (patch) | |
tree | 52ebf3d1d6e385838d0aa182c0efc731dc08d67d /src | |
parent | 0063b26ed99c741d5ffde75468af23fb6b2eefed (diff) |
logind: check file is device node before using .st_rdev
Diffstat (limited to 'src')
-rw-r--r-- | src/login/logind.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/login/logind.c b/src/login/logind.c index ed250bc2a..481c5e40e 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -480,6 +480,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 |