summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2014-03-14 08:28:31 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2018-11-30 20:49:28 +0100
commit5993b355cbd25c45897eab3a9dbe099fccebcb41 (patch)
treed1e71ed12a70faa1904c90617c68cb233fc2b3d6
parent5788b4bd8ae0cc9274801495a69bac629b3e5a7d (diff)
downloaddrakx-5993b355cbd25c45897eab3a9dbe099fccebcb41.tar
drakx-5993b355cbd25c45897eab3a9dbe099fccebcb41.tar.gz
drakx-5993b355cbd25c45897eab3a9dbe099fccebcb41.tar.bz2
drakx-5993b355cbd25c45897eab3a9dbe099fccebcb41.tar.xz
drakx-5993b355cbd25c45897eab3a9dbe099fccebcb41.zip
actually call regular mount
now that we've it in stage1 anyway (since using dracut)
-rw-r--r--mdk-stage1/NEWS3
-rw-r--r--mdk-stage1/mount.c14
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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <stdio.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -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);