xwayland: set CLOEXEC on /dev/null FD
This avoids leaking the FD to Xwayland and its children.
This commit is contained in:
parent
6a8f17b5f6
commit
8363ca8c9f
|
@ -1,4 +1,4 @@
|
||||||
#define _POSIX_C_SOURCE 200112L
|
#define _POSIX_C_SOURCE 200809L
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -92,7 +92,7 @@ _Noreturn static void exec_xwayland(struct wlr_xwayland *wlr_xwayland) {
|
||||||
|
|
||||||
// Closes stdout/stderr depending on log verbosity
|
// Closes stdout/stderr depending on log verbosity
|
||||||
enum wlr_log_importance verbosity = wlr_log_get_verbosity();
|
enum wlr_log_importance verbosity = wlr_log_get_verbosity();
|
||||||
int devnull = open("/dev/null", O_WRONLY | O_CREAT, 0666);
|
int devnull = open("/dev/null", O_WRONLY | O_CREAT | O_CLOEXEC, 0666);
|
||||||
if (devnull < 0) {
|
if (devnull < 0) {
|
||||||
wlr_log_errno(WLR_ERROR, "XWayland: failed to open /dev/null");
|
wlr_log_errno(WLR_ERROR, "XWayland: failed to open /dev/null");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
|
|
Loading…
Reference in New Issue