kumquat-buildroot/package/audit/0004-Do-not-call-posix_fallocate-if-unavailable.patch

48 lines
1.7 KiB
Diff
Raw Normal View History

From 3f44df90f60c692127f84de090cd5337f627e1c2 Mon Sep 17 00:00:00 2001
From: Clayton Shotwell <clayton.shotwell@rockwellcollins.com>
Date: Wed, 1 Apr 2015 07:49:54 -0500
Subject: [PATCH] Do not call posix_fallocate() if unavailable
uClibc does not implement posix_fallocate(), and posix_fallocate() is
mostly only an hint to the kernel that we will need such or such
amount of space inside a file. Adding a check around the
posix_fallocate() call so it is only called when it is available.
Signed-off-by: Clayton Shotwell <clayton.shotwell@rockwellcollins.com>
---
audisp/plugins/remote/queue.c | 2 ++
configure.ac | 1 +
2 files changed, 3 insertions(+)
diff --git a/audisp/plugins/remote/queue.c b/audisp/plugins/remote/queue.c
index 79eebd7..971e4e4 100644
--- a/audisp/plugins/remote/queue.c
+++ b/audisp/plugins/remote/queue.c
@@ -215,9 +215,11 @@ static int q_open_file(struct queue *q, const char *path)
return -1;
if (q_sync(q) != 0)
return -1;
+#ifdef HAVE_POSIX_FALLOCATE
if (posix_fallocate(q->fd, 0,
(q->num_entries + 1) * q->entry_size) != 0)
return -1;
+#endif
} else {
uint32_t file_entries;
if (full_pread(q->fd, &fh, sizeof(fh), 0) != 0)
diff --git a/configure.ac b/configure.ac
index 57aec03..c14ec80 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,7 @@ AC_CHECK_DECLS([MS_DIRSYNC], [], [], [[#include <sys/mount.h>]])
AC_CHECK_DECLS([AUDIT_FEATURE_VERSION], [], [], [[#include <linux/audit.h>]])
AC_CHECK_DECLS([AUDIT_VERSION_BACKLOG_WAIT_TIME], [], [], [[#include <linux/audit.h>]])
AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])
+AC_CHECK_FUNCS([posix_fallocate])
ALLWARNS=""
ALLDEBUG="-g"
--
1.9.1