noop: Additional open flags for open(2)

Matching the functionallity by the seatd open call. O_NONBLOCK is
specially important for libseat, otherwise it hangs while trying to
drain all events from an input device fd.

Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
This commit is contained in:
Anna (navi) Figueiredo Gomes 2023-03-30 07:58:51 -03:00 committed by Kenny Levinsen
parent e5b018def8
commit 56720a6275

View file

@ -52,7 +52,7 @@ static const char *seat_name(struct libseat *base) {
static int open_device(struct libseat *base, const char *path, int *fd) { static int open_device(struct libseat *base, const char *path, int *fd) {
(void)base; (void)base;
int tmpfd = open(path, O_RDWR | O_CLOEXEC); int tmpfd = open(path, O_RDWR | O_NOCTTY | O_NOFOLLOW | O_CLOEXEC | O_NONBLOCK);
if (tmpfd < 0) { if (tmpfd < 0) {
log_errorf("Failed to open device: %s", strerror(errno)); log_errorf("Failed to open device: %s", strerror(errno));
return -1; return -1;