[Xcb-commit] xcb/util-cursor: cursor
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Mar 29 15:24:25 UTC 2023
cursor/load_cursor.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
New commits:
commit 9b9ec3cfd1db9fac09b119715dabc36aaa77f497
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Tue Mar 28 11:33:43 2023 -0700
Set close-on-exec when opening files
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
diff --git a/cursor/load_cursor.c b/cursor/load_cursor.c
index e82fc63..7cd53cf 100644
--- a/cursor/load_cursor.c
+++ b/cursor/load_cursor.c
@@ -44,6 +44,13 @@
#include "cursor.h"
#include "xcb_cursor.h"
+#ifdef O_CLOEXEC
+#define FOPEN_CLOEXEC "e"
+#else
+#define FOPEN_CLOEXEC ""
+#define O_CLOEXEC 0
+#endif
+
static const char *cursor_path(struct xcb_cursor_context_t *c) {
if (c->path == NULL) {
c->path = getenv("XCURSOR_PATH");
@@ -76,7 +83,7 @@ _XcursorThemeInherits (const char *full)
if (!full)
return NULL;
- f = fopen (full, "r");
+ f = fopen (full, "r" FOPEN_CLOEXEC);
if (f)
{
while (fgets (line, sizeof (line), f))
@@ -155,7 +162,7 @@ static int open_cursor_file(xcb_cursor_context_t *c, const char *theme, const ch
free(themedir);
return -1;
}
- fd = open(full, O_RDONLY);
+ fd = open(full, O_RDONLY | O_CLOEXEC);
free(full);
if (fd == -1 && inherits == NULL) {
if (asprintf(&full, "%s/index.theme", themedir) == -1) {
More information about the xcb-commit
mailing list