summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eina/eina_file.c')
-rw-r--r--src/lib/eina/eina_file.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/lib/eina/eina_file.c b/src/lib/eina/eina_file.c
index cc53f65cce..068aa12e14 100644
--- a/src/lib/eina/eina_file.c
+++ b/src/lib/eina/eina_file.c
@@ -802,19 +802,28 @@ eina_file_open(const char *path, Eina_Bool shared)
802 if (!filename) return NULL; 802 if (!filename) return NULL;
803 803
804 if (shared) 804 if (shared)
805 {
805#ifdef HAVE_SHM_OPEN 806#ifdef HAVE_SHM_OPEN
806 fd = shm_open(filename, O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO); 807 fd = shm_open(filename, O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
808 if ((fd != -1) && (!eina_file_close_on_exec(fd, EINA_TRUE)))
809 goto on_error;
807#else 810#else
808 goto on_error; 811 goto on_error;
809#endif 812#endif
813 }
810 else 814 else
811 fd = open(filename, O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO); 815 {
816#ifdef HAVE_OPEN_CLOEXEC
817 fd = open(filename, O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO | O_CLOEXEC);
818#else
819 fd = open(filename, O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
820 if ((fd != -1) && (!eina_file_close_on_exec(fd, EINA_TRUE)))
821 goto on_error;
822#endif
823 }
812 824
813 if (fd < 0) goto on_error; 825 if (fd < 0) goto on_error;
814 826
815 if (!eina_file_close_on_exec(fd, EINA_TRUE))
816 goto on_error;
817
818 if (fstat(fd, &file_stat)) 827 if (fstat(fd, &file_stat))
819 goto on_error; 828 goto on_error;
820 829