summaryrefslogtreecommitdiff
blob: f92cba390e665b577755293fb06b9aa0bbaf917d (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
60
61
62
63
From 82f7e46c8fdb2bb41b7b26916e463add7af70a94 Mon Sep 17 00:00:00 2001
From: xtraeme <xtraeme@voidlinux.eu>
Date: Tue, 2 Jun 2015 11:11:21 +0200
Subject: [PATCH 5/5] Portability fixes:

- Use uid_t not __uid_t.
- Define _GNU_SOURCE for cpu_set_t and others.
- Include string.h for strncmp().
- Detect musl's ldd error message.
---
 install/dracut-install.c | 7 ++++++-
 install/util.h           | 3 +++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/install/dracut-install.c b/install/dracut-install.c
index 201f181..0ff5c49 100644
--- a/install/dracut-install.c
+++ b/install/dracut-install.c
@@ -222,7 +222,7 @@ static int cp(const char *src, const char *dst)
                 if (ret == 0) {
                         struct timeval tv[2];
                         if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
-                                if(fchown(dest_desc, (__uid_t) - 1, sb.st_gid) != 0)
+                                if(fchown(dest_desc, (uid_t) - 1, sb.st_gid) != 0)
                                     log_error("Failed to chown %s: %m", dst);
                         tv[0].tv_sec = sb.st_atime;
                         tv[0].tv_usec = 0;
@@ -388,6 +388,11 @@ static int resolve_deps(const char *src)
                         break;
                 }
 
+		/* musl ldd */
+		if (strstr(buf, "Not a valid dynamic program"))
+			break;
+
+		/* glibc */
                 if (strstr(buf, "not a dynamic executable"))
                         break;
 
diff --git a/install/util.h b/install/util.h
index cc7b988..2ad3254 100644
--- a/install/util.h
+++ b/install/util.h
@@ -20,6 +20,8 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#define _GNU_SOURCE
+
 #include <inttypes.h>
 #include <time.h>
 #include <sys/time.h>
@@ -27,6 +29,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <signal.h>
 #include <sched.h>
 #include <limits.h>
-- 
2.4.1