diff options
| author | Simon Ser <contact@emersion.fr> | 2020-11-06 09:57:03 +0100 | 
|---|---|---|
| committer | Simon Ser <contact@emersion.fr> | 2020-11-19 22:47:49 +0100 | 
| commit | 63df2bcbe656b394b0bd152ab69147194dd74815 (patch) | |
| tree | a1fa4407cdf9ac9ed39e01012346d39d720ff9d2 | |
| parent | fb3bea80144ea25fb21de8a3eeb0c9249f4cbfd6 (diff) | |
| download | wlroots-63df2bcbe656b394b0bd152ab69147194dd74815.tar.xz | |
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.
| -rw-r--r-- | backend/session/session.c | 4 | 
1 files changed, 3 insertions, 1 deletions
diff --git a/backend/session/session.c b/backend/session/session.c index d8e9509d..e3e108af 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -6,6 +6,7 @@  #include <string.h>  #include <sys/stat.h>  #include <sys/types.h> +#include <unistd.h>  #include <wayland-server-core.h>  #include <wlr/backend/session.h>  #include <wlr/backend/session/interface.h> @@ -195,7 +196,8 @@ int wlr_session_open_file(struct wlr_session *session, const char *path) {  error:  	free(dev); -	return fd; +	close(fd); +	return -1;  }  static struct wlr_device *find_device(struct wlr_session *session, int fd) {  | 
