From 5993b355cbd25c45897eab3a9dbe099fccebcb41 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 14 Mar 2014 08:28:31 +0100 Subject: actually call regular mount now that we've it in stage1 anyway (since using dracut) --- mdk-stage1/NEWS | 3 +++ mdk-stage1/mount.c | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS index 86113ece8..2899d7a9c 100644 --- a/mdk-stage1/NEWS +++ b/mdk-stage1/NEWS @@ -1,3 +1,6 @@ +- mounting: + o use regular mount tool rather than manual system calls + 2.33 - advertize "ext4" rather than "ext2" diff --git a/mdk-stage1/mount.c b/mdk-stage1/mount.c index 7588893dc..858beaf90 100644 --- a/mdk-stage1/mount.c +++ b/mdk-stage1/mount.c @@ -19,10 +19,12 @@ * */ +// for asprintf: +#define _GNU_SOURCE +#include #include #include #include -#include #include #include #include @@ -57,7 +59,6 @@ int ensure_dev_exists(const char * dev) /* mounts, creating the device if needed+possible */ int my_mount(char *dev, char *location, char *fs, int force_rw) { - unsigned long flags = MS_MGC_VAL | (force_rw ? 0 : MS_RDONLY); char * opts = NULL; struct stat buf; int rc; @@ -133,7 +134,14 @@ int my_mount(char *dev, char *location, char *fs, int force_rw) } #endif - rc = mount(dev, location, fs, flags, opts); + char *cmd; + rc = asprintf(&cmd, "mount %s %s -t %s -o %s%s", dev, location, fs, (force_rw ? "" : "ro,"), (opts ? opts : "")); + if (rc == -1) { + log_perror("asprint allocation failure"); + rmdir(location); + return rc; + } + rc = system(cmd); if (rc != 0) { log_perror("mount failed"); rmdir(location); -- cgit v1.2.1