summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/libudev/util.c11
2 files changed, 9 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 500bf12e50..e559300191 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,7 @@ AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_CHECK_MEMBERS([struct stat.st_rdev])
-AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, accept4], [], [], [[#include <sys/types.h>
+AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, accept4, mkostemp], [], [], [[#include <sys/types.h>
#include <unistd.h>
#include <sys/mount.h>
#include <fcntl.h>
diff --git a/src/libudev/util.c b/src/libudev/util.c
index 43defd35b5..1d57a01567 100644
--- a/src/libudev/util.c
+++ b/src/libudev/util.c
@@ -4300,10 +4300,10 @@ int execute_command(const char *command, char *const argv[])
{
pid_t pid;
- int status;
+ int status;
- if ((status = access(command, X_OK)) != 0)
- return status;
+ if ((status = access(command, X_OK)) != 0)
+ return status;
if ((pid = fork()) < 0) {
log_error("Failed to fork: %m");
@@ -4582,7 +4582,12 @@ int fopen_temporary(const char *path, FILE **_f, char **_temp_path) {
t[k] = '.';
stpcpy(stpcpy(t+k+1, fn), "XXXXXX");
+#if HAVE_DECL_MKOSTEMP
fd = mkostemp(t, O_WRONLY|O_CLOEXEC);
+#else
+ fd = mkstemp(t);
+ fcntl(t, F_SETFD, FD_CLOEXEC);
+#endif
if (fd < 0) {
free(t);
return -errno;