public inbox for initramfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Amadeusz Żołnowski" <aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: xtraeme <xtraeme-Dz/b8W81T9G0sumixwIyNQ@public.gmane.org>
Subject: [PATCH] Portability fixes
Date: Tue,  2 Jun 2015 11:18:32 +0200	[thread overview]
Message-ID: <1433236712-31133-1-git-send-email-aidecoe@aidecoe.name> (raw)

From: xtraeme <xtraeme-Dz/b8W81T9G0sumixwIyNQ@public.gmane.org>

- 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

             reply	other threads:[~2015-06-02  9:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02  9:18 Amadeusz Żołnowski [this message]
     [not found] ` <1433236712-31133-1-git-send-email-aidecoe-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
2015-06-02 10:25   ` [PATCH] Portability fixes Harald Hoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433236712-31133-1-git-send-email-aidecoe@aidecoe.name \
    --to=aidecoe-2qtfh70ttyba5ebddlwbiw@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=xtraeme-Dz/b8W81T9G0sumixwIyNQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox