summaryrefslogtreecommitdiffstats
path: root/fuse/mount_util.c
diff options
context:
space:
mode:
authorMatt Mower <mowerm@gmail.com>2015-12-13 18:31:00 +0100
committerEthan Yonker <dees_troy@teamw.in>2015-12-23 16:58:04 +0100
commit523a059fb7d5844ebcca279b2f83aff9164b444c (patch)
tree4353fa9fa64a17ef2c5548f0c9f73f5e5f389f6a /fuse/mount_util.c
parentexfat: Update to 1.2.2 (diff)
downloadandroid_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar
android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar.gz
android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar.bz2
android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar.lz
android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar.xz
android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.tar.zst
android_bootable_recovery-523a059fb7d5844ebcca279b2f83aff9164b444c.zip
Diffstat (limited to 'fuse/mount_util.c')
-rw-r--r--fuse/mount_util.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/fuse/mount_util.c b/fuse/mount_util.c
index bfd801fff..020b223dc 100644
--- a/fuse/mount_util.c
+++ b/fuse/mount_util.c
@@ -16,16 +16,23 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
-#include <mntent.h>
#include <paths.h>
+#ifndef __NetBSD__
+#include <mntent.h>
+#endif
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/mount.h>
#include <sys/param.h>
+#if defined(__ANDROID__)
+#include <paths.h>
+#endif
#ifdef __NetBSD__
#define umount2(mnt, flags) unmount(mnt, (flags == 2) ? MNT_FORCE : 0)
#define mtab_needs_update(mnt) 0
+#elif defined(__ANDROID__)
+#define mtab_needs_update(mnt) 0
#else
static int mtab_needs_update(const char *mnt)
{
@@ -94,10 +101,12 @@ static int add_mount(const char *progname, const char *fsname,
goto out_restore;
}
if (res == 0) {
+ char *env = NULL;
+
sigprocmask(SIG_SETMASK, &oldmask, NULL);
setuid(geteuid());
- execl("/bin/mount", "/bin/mount", "--no-canonicalize", "-i",
- "-f", "-t", type, "-o", opts, fsname, mnt, NULL);
+ execle("/bin/mount", "/bin/mount", "--no-canonicalize", "-i",
+ "-f", "-t", type, "-o", opts, fsname, mnt, NULL, &env);
fprintf(stderr, "%s: failed to execute /bin/mount: %s\n",
progname, strerror(errno));
exit(1);
@@ -145,10 +154,17 @@ static int exec_umount(const char *progname, const char *rel_mnt, int lazy)
goto out_restore;
}
if (res == 0) {
+ char *env = NULL;
+
sigprocmask(SIG_SETMASK, &oldmask, NULL);
setuid(geteuid());
- execl("/bin/umount", "/bin/umount", "-i", rel_mnt,
- lazy ? "-l" : NULL, NULL);
+ if (lazy) {
+ execle("/bin/umount", "/bin/umount", "-i", rel_mnt,
+ "-l", NULL, &env);
+ } else {
+ execle("/bin/umount", "/bin/umount", "-i", rel_mnt,
+ NULL, &env);
+ }
fprintf(stderr, "%s: failed to execute /bin/umount: %s\n",
progname, strerror(errno));
exit(1);
@@ -204,10 +220,12 @@ static int remove_mount(const char *progname, const char *mnt)
goto out_restore;
}
if (res == 0) {
+ char *env = NULL;
+
sigprocmask(SIG_SETMASK, &oldmask, NULL);
setuid(geteuid());
- execl("/bin/umount", "/bin/umount", "--no-canonicalize", "-i",
- "--fake", mnt, NULL);
+ execle("/bin/umount", "/bin/umount", "--no-canonicalize", "-i",
+ "--fake", mnt, NULL, &env);
fprintf(stderr, "%s: failed to execute /bin/umount: %s\n",
progname, strerror(errno));
exit(1);
@@ -300,7 +318,7 @@ char *fuse_mnt_resolve_path(const char *progname, const char *orig)
}
int fuse_mnt_check_empty(const char *progname, const char *mnt,
- mode_t rootmode, off64_t rootsize)
+ mode_t rootmode, loff_t rootsize)
{
int isempty = 1;