1 |
aidecoe 15/06/02 09:34:01 |
2 |
|
3 |
Added: 041-r2-0004-Portability-fixes.patch |
4 |
Log: |
5 |
Make dracut tools compile on musl. Fix bug #550204. |
6 |
|
7 |
(Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key F0134531E1DBFAB5) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sys-kernel/dracut/files/041-r2-0004-Portability-fixes.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-kernel/dracut/files/041-r2-0004-Portability-fixes.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-kernel/dracut/files/041-r2-0004-Portability-fixes.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: 041-r2-0004-Portability-fixes.patch |
16 |
=================================================================== |
17 |
From 82f7e46c8fdb2bb41b7b26916e463add7af70a94 Mon Sep 17 00:00:00 2001 |
18 |
From: xtraeme <xtraeme@×××××××××.eu> |
19 |
Date: Tue, 2 Jun 2015 11:11:21 +0200 |
20 |
Subject: [PATCH 5/5] Portability fixes: |
21 |
|
22 |
- Use uid_t not __uid_t. |
23 |
- Define _GNU_SOURCE for cpu_set_t and others. |
24 |
- Include string.h for strncmp(). |
25 |
- Detect musl's ldd error message. |
26 |
--- |
27 |
install/dracut-install.c | 7 ++++++- |
28 |
install/util.h | 3 +++ |
29 |
2 files changed, 9 insertions(+), 1 deletion(-) |
30 |
|
31 |
diff --git a/install/dracut-install.c b/install/dracut-install.c |
32 |
index 201f181..0ff5c49 100644 |
33 |
--- a/install/dracut-install.c |
34 |
+++ b/install/dracut-install.c |
35 |
@@ -222,7 +222,7 @@ static int cp(const char *src, const char *dst) |
36 |
if (ret == 0) { |
37 |
struct timeval tv[2]; |
38 |
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0) |
39 |
- if(fchown(dest_desc, (__uid_t) - 1, sb.st_gid) != 0) |
40 |
+ if(fchown(dest_desc, (uid_t) - 1, sb.st_gid) != 0) |
41 |
log_error("Failed to chown %s: %m", dst); |
42 |
tv[0].tv_sec = sb.st_atime; |
43 |
tv[0].tv_usec = 0; |
44 |
@@ -388,6 +388,11 @@ static int resolve_deps(const char *src) |
45 |
break; |
46 |
} |
47 |
|
48 |
+ /* musl ldd */ |
49 |
+ if (strstr(buf, "Not a valid dynamic program")) |
50 |
+ break; |
51 |
+ |
52 |
+ /* glibc */ |
53 |
if (strstr(buf, "not a dynamic executable")) |
54 |
break; |
55 |
|
56 |
diff --git a/install/util.h b/install/util.h |
57 |
index cc7b988..2ad3254 100644 |
58 |
--- a/install/util.h |
59 |
+++ b/install/util.h |
60 |
@@ -20,6 +20,8 @@ |
61 |
along with systemd; If not, see <http://www.gnu.org/licenses/>. |
62 |
***/ |
63 |
|
64 |
+#define _GNU_SOURCE |
65 |
+ |
66 |
#include <inttypes.h> |
67 |
#include <time.h> |
68 |
#include <sys/time.h> |
69 |
@@ -27,6 +29,7 @@ |
70 |
#include <stdbool.h> |
71 |
#include <stdlib.h> |
72 |
#include <stdio.h> |
73 |
+#include <string.h> |
74 |
#include <signal.h> |
75 |
#include <sched.h> |
76 |
#include <limits.h> |
77 |
-- |
78 |
2.4.1 |