mirror of
https://gitlab.freedesktop.org/xorg/lib/libxcursor.git
synced 2025-12-20 04:40:11 +01:00
If O_CLOEXEC is defined, add "e" to fopen modes
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
81dc4a481b
commit
a353f02a7a
4 changed files with 17 additions and 10 deletions
|
|
@ -146,7 +146,7 @@ _XcursorPixelToColor (XcursorPixel p, XColor *color)
|
|||
static void
|
||||
_XcursorDumpImage (XImage *image)
|
||||
{
|
||||
FILE *f = fopen ("/tmp/images", "a");
|
||||
FILE *f = fopen ("/tmp/images", "a" FOPEN_CLOEXEC);
|
||||
int x, y;
|
||||
if (!f)
|
||||
return;
|
||||
|
|
@ -164,7 +164,7 @@ _XcursorDumpImage (XImage *image)
|
|||
static void
|
||||
_XcursorDumpColor (XColor *color, char *name)
|
||||
{
|
||||
FILE *f = fopen ("/tmp/images", "a");
|
||||
FILE *f = fopen ("/tmp/images", "a" FOPEN_CLOEXEC);
|
||||
fprintf (f, "%s: %x %x %x\n", name,
|
||||
color->red, color->green, color->blue);
|
||||
fflush (f);
|
||||
|
|
|
|||
12
src/file.c
12
src/file.c
|
|
@ -1019,7 +1019,7 @@ XcursorFilenameLoadImage (const char *file, int size)
|
|||
if (!file || size < 0)
|
||||
return NULL;
|
||||
|
||||
f = fopen (file, "r");
|
||||
f = fopen (file, "r" FOPEN_CLOEXEC);
|
||||
if (!f)
|
||||
return NULL;
|
||||
image = XcursorFileLoadImage (f, size);
|
||||
|
|
@ -1036,7 +1036,7 @@ XcursorFilenameLoadImages (const char *file, int size)
|
|||
if (!file || size < 0)
|
||||
return NULL;
|
||||
|
||||
f = fopen (file, "r");
|
||||
f = fopen (file, "r" FOPEN_CLOEXEC);
|
||||
if (!f)
|
||||
return NULL;
|
||||
images = XcursorFileLoadImages (f, size);
|
||||
|
|
@ -1053,7 +1053,7 @@ XcursorFilenameLoadAllImages (const char *file)
|
|||
if (!file)
|
||||
return NULL;
|
||||
|
||||
f = fopen (file, "r");
|
||||
f = fopen (file, "r" FOPEN_CLOEXEC);
|
||||
if (!f)
|
||||
return NULL;
|
||||
images = XcursorFileLoadAllImages (f);
|
||||
|
|
@ -1072,7 +1072,7 @@ XcursorFilenameLoad (const char *file,
|
|||
if (!file)
|
||||
return XcursorFalse;
|
||||
|
||||
f = fopen (file, "r");
|
||||
f = fopen (file, "r" FOPEN_CLOEXEC);
|
||||
if (!f)
|
||||
return 0;
|
||||
ret = XcursorFileLoad (f, commentsp, imagesp);
|
||||
|
|
@ -1089,7 +1089,7 @@ XcursorFilenameSaveImages (const char *file, const XcursorImages *images)
|
|||
if (!file || !images)
|
||||
return XcursorFalse;
|
||||
|
||||
f = fopen (file, "w");
|
||||
f = fopen (file, "w" FOPEN_CLOEXEC);
|
||||
if (!f)
|
||||
return 0;
|
||||
ret = XcursorFileSaveImages (f, images);
|
||||
|
|
@ -1107,7 +1107,7 @@ XcursorFilenameSave (const char *file,
|
|||
if (!file || !comments || !images)
|
||||
return XcursorFalse;
|
||||
|
||||
f = fopen (file, "w");
|
||||
f = fopen (file, "w" FOPEN_CLOEXEC);
|
||||
if (!f)
|
||||
return 0;
|
||||
ret = XcursorFileSave (f, comments, images);
|
||||
|
|
|
|||
|
|
@ -172,7 +172,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))
|
||||
|
|
@ -254,7 +254,7 @@ XcursorScanTheme (const char *theme, const char *name)
|
|||
full = _XcursorBuildFullname (dir, "cursors", name);
|
||||
if (full)
|
||||
{
|
||||
f = fopen (full, "r");
|
||||
f = fopen (full, "r" FOPEN_CLOEXEC);
|
||||
free (full);
|
||||
}
|
||||
if (!f && inherits[d + 1].line == NULL)
|
||||
|
|
|
|||
|
|
@ -38,6 +38,13 @@
|
|||
#include "Xcursor.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#ifdef O_CLOEXEC
|
||||
#define FOPEN_CLOEXEC "e"
|
||||
#else
|
||||
#define FOPEN_CLOEXEC ""
|
||||
#endif
|
||||
|
||||
typedef struct _XcursorFontInfo {
|
||||
struct _XcursorFontInfo *next;
|
||||
Font font;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue