mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 06:05:58 +01:00
backend/session: don't return FD on failure in open_file
When wlr_session_open_file fails, don't return the FD, otherwise the caller will think the call succeeded.
This commit is contained in:
parent
fb3bea8014
commit
63df2bcbe6
1 changed files with 3 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/backend/session.h>
|
#include <wlr/backend/session.h>
|
||||||
#include <wlr/backend/session/interface.h>
|
#include <wlr/backend/session/interface.h>
|
||||||
|
@ -195,7 +196,8 @@ int wlr_session_open_file(struct wlr_session *session, const char *path) {
|
||||||
|
|
||||||
error:
|
error:
|
||||||
free(dev);
|
free(dev);
|
||||||
return fd;
|
close(fd);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_device *find_device(struct wlr_session *session, int fd) {
|
static struct wlr_device *find_device(struct wlr_session *session, int fd) {
|
||||||
|
|
Loading…
Reference in a new issue