aboutsummaryrefslogtreecommitdiff
path: root/package/systemd/systemd-uclibc-fix.patch
blob: 9a208450ad9c3928b0858c14efa3f5306521761a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[PATCH] fix build with uClibc

Based on OE patch from Khem Raj:

http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch

But extended to also cover execvpe (OE carries a patch adding execvpe
support to uClibc).

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
 src/journal/journal-file.c |    2 ++
 src/macro.h                |   15 +++++++++++++++
 2 files changed, 17 insertions(+)

Index: systemd-44/src/macro.h
===================================================================
--- systemd-44.orig/src/macro.h
+++ systemd-44/src/macro.h
@@ -28,6 +28,21 @@
 #include <sys/uio.h>
 #include <inttypes.h>
 
+#ifdef __UCLIBC__
+/* uclibc does not implement mkostemp GNU extension */
+#define mkostemp(x,y) mkstemp(x)
+/* uclibc does not implement execvpe GNU extension */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <unistd.h>
+static inline int execvpe(const char *file, char *const argv[],
+                          char *const envp[])
+{
+        environ = (char **)envp;
+        return execvp(file, argv);
+}
+#endif
 #define _printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
 #define _sentinel_ __attribute__ ((sentinel))
 #define _noreturn_ __attribute__((noreturn))
Index: systemd-44/src/journal/journal-file.c
===================================================================
--- systemd-44.orig/src/journal/journal-file.c
+++ systemd-44/src/journal/journal-file.c
@@ -229,11 +229,13 @@
                 }
         }
 
+#ifndef __UCLIBC__
         /* Note that the glibc fallocate() fallback is very
            inefficient, hence we try to minimize the allocation area
            as we can. */
         if (posix_fallocate(f->fd, old_size, new_size - old_size) < 0)
                 return -errno;
+#endif
 
         if (fstat(f->fd, &f->last_stat) < 0)
                 return -errno;