File redland-ocloexec.patch of Package redland
--- configure.ac 2011-12-04 03:43:19.000000000 +0100
+++ configure.ac 2011-12-21 14:28:11.441688112 +0100
@@ -100,7 +100,9 @@
dnl Checks for programs.
AM_SANITY_CHECK
-AC_PROG_CC
+AC_PROG_CC_STDC
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_LN_S
--- src/rdf_files.c 2011-08-01 05:56:47.000000000 +0200
+++ src/rdf_files.c 2011-12-21 14:28:11.440688113 +0100
@@ -44,6 +44,8 @@
#endif
#endif
+#include <fcntl.h>
+
#ifdef STANDALONE
#define LIBRDF_DEBUG 1
#endif
@@ -91,7 +93,7 @@
#ifdef HAVE_MKSTEMP
/* Proritise mkstemp() since GNU libc says: Never use mktemp(). */
- fd=mkstemp(name);
+ fd=mkostemp(name, O_CLOEXEC);
if(fd<0) {
LIBRDF_FREE(char*, name);
return NULL;
--- src/rdf_parser_raptor.c 2011-11-04 17:08:18.000000000 +0100
+++ src/rdf_parser_raptor.c 2011-12-21 14:28:11.440688113 +0100
@@ -571,7 +571,7 @@
if(!filename)
return NULL;
- fh=fopen(filename, "r");
+ fh=fopen(filename, "re");
if(!fh) {
librdf_log(pcontext->parser->world, 0, LIBRDF_LOG_ERROR,
LIBRDF_FROM_PARSER, NULL, "failed to open file '%s' - %s",
--- src/rdf_query_results.c 2011-11-04 17:08:18.000000000 +0100
+++ src/rdf_query_results.c 2011-12-21 14:28:11.440688113 +0100
@@ -602,7 +602,7 @@
LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, query_results, 1);
LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(name, string, 1);
- fh = fopen(name, "w+");
+ fh = fopen(name, "w+e");
if(!fh) {
librdf_log(query_results->query->world, 0, LIBRDF_LOG_ERROR,
LIBRDF_FROM_QUERY, NULL,
--- src/rdf_serializer.c 2011-11-04 17:08:18.000000000 +0100
+++ src/rdf_serializer.c 2011-12-21 14:28:11.439688113 +0100
@@ -556,7 +556,7 @@
LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(name, string, 1);
LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(stream, librdf_stream, 1);
- fh=fopen(name, "w+");
+ fh=fopen(name, "w+e");
if(!fh) {
librdf_log(serializer->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_SERIALIZER,
NULL, "failed to open file '%s' for writing - %s",
@@ -595,7 +595,7 @@
LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(name, string, 1);
LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(model, librdf_model, 1);
- fh=fopen(name, "w+");
+ fh=fopen(name, "w+e");
if(!fh) {
librdf_log(serializer->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_SERIALIZER,
NULL, "failed to open file '%s' for writing - %s",
@@ -1099,7 +1099,7 @@
stream=librdf_model_as_stream(model);
#define FILENAME "test.rdf"
- fh=fopen(FILENAME, "w");
+ fh=fopen(FILENAME, "we");
if(!fh) {
fprintf(stderr, "%s: Failed to fopen for writing '%s' - %s\n",
program, FILENAME, strerror(errno));
--- src/rdf_storage_file.c 2011-08-01 05:56:47.000000000 +0200
+++ src/rdf_storage_file.c 2011-12-21 14:28:11.439688113 +0100
@@ -329,7 +329,7 @@
return 1;
}
- fh=fopen(new_name, "w+");
+ fh=fopen(new_name, "w+e");
if(!fh) {
librdf_log(storage->world, 0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STORAGE, NULL,
"failed to open file '%s' for writing - %s",