summaryrefslogtreecommitdiffstats
path: root/fuse/mount.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.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.c')
-rw-r--r--fuse/mount.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/fuse/mount.c b/fuse/mount.c
index af7218fa4..eb0bb17d3 100644
--- a/fuse/mount.c
+++ b/fuse/mount.c
@@ -36,13 +36,16 @@
#define MS_SYNCHRONOUS MNT_SYNCHRONOUS
#define MS_NOATIME MNT_NOATIME
-
#define umount2(mnt, flags) unmount(mnt, (flags == 2) ? MNT_FORCE : 0)
#endif
#define FUSERMOUNT_PROG "fusermount"
#define FUSE_COMMFD_ENV "_FUSE_COMMFD"
+#if defined(__ANDROID__) && !defined(FUSERMOUNT_DIR)
+# define FUSERMOUNT_DIR "/system/xbin"
+#endif
+
#ifndef HAVE_FORK
#define fork() vfork()
#endif
@@ -138,7 +141,6 @@ static void mount_help(void)
"\n");
}
-#define FUSERMOUNT_DIR "/usr/bin"
static void exec_fusermount(const char *argv[])
{
execv(FUSERMOUNT_DIR "/" FUSERMOUNT_PROG, (char **) argv);
@@ -302,14 +304,18 @@ void fuse_kern_unmount(const char *mountpoint, int fd)
pfd.fd = fd;
pfd.events = 0;
res = poll(&pfd, 1, 0);
+
+ /* Need to close file descriptor, otherwise synchronous umount
+ would recurse into filesystem, and deadlock.
+
+ Caller expects fuse_kern_unmount to close the fd, so close it
+ anyway. */
+ close(fd);
+
/* If file poll returns POLLERR on the device file descriptor,
then the filesystem is already unmounted */
if (res == 1 && (pfd.revents & POLLERR))
return;
-
- /* Need to close file descriptor, otherwise synchronous umount
- would recurse into filesystem, and deadlock */
- close(fd);
}
if (geteuid() == 0) {
@@ -465,7 +471,7 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
return -1;
}
- snprintf(tmp, sizeof(tmp), "fd=%i,rootmode=%o,user_id=%i,group_id=%i",
+ snprintf(tmp, sizeof(tmp), "fd=%i,rootmode=%o,user_id=%u,group_id=%u",
fd, stbuf.st_mode & S_IFMT, getuid(), getgid());
res = fuse_opt_add_opt(&mo->kernel_opts, tmp);