From: xtraeme Date: Tue, 2 Jun 2015 09:11:21 +0000 (+0200) Subject: Portability fixes: X-Git-Tag: 042~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=696416936851f3f80cc721cee38553fddbdb868f;p=thirdparty%2Fdracut.git 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. --- diff --git a/install/dracut-install.c b/install/dracut-install.c index 201f1815e..0ff5c495f 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 cc7b988a9..2ad3254d9 100644 --- a/install/util.h +++ b/install/util.h @@ -20,6 +20,8 @@ along with systemd; If not, see . ***/ +#define _GNU_SOURCE + #include #include #include @@ -27,6 +29,7 @@ #include #include #include +#include #include #include #include