]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Portability fixes:
authorxtraeme <xtraeme@voidlinux.eu>
Tue, 2 Jun 2015 09:11:21 +0000 (11:11 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 2 Jun 2015 09:17:13 +0000 (11:17 +0200)
- 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
install/util.h

index 201f1815e5447dd3ca32e60626d766e06ed0fd84..0ff5c495f587d187a081c66d6998a379b83f8af8 100644 (file)
@@ -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;
 
index cc7b988a97da15eb3d09feacea040e2f0a77ae47..2ad3254d9f54727733c8a33e8311a25f545558d1 100644 (file)
@@ -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>