diff options
author | Karel Zak | 2011-02-11 10:45:09 +0100 |
---|---|---|
committer | Karel Zak | 2011-02-11 10:45:09 +0100 |
commit | db9bd703a9a696bd73cb7d41e98c66854a604477 (patch) | |
tree | 320957c715e93c157ec9a0ccc70065cc03fec766 /shlibs | |
parent | include: [at.h]: include c.h for PATH_MAX (diff) | |
download | kernel-qcow2-util-linux-db9bd703a9a696bd73cb7d41e98c66854a604477.tar.gz kernel-qcow2-util-linux-db9bd703a9a696bd73cb7d41e98c66854a604477.tar.xz kernel-qcow2-util-linux-db9bd703a9a696bd73cb7d41e98c66854a604477.zip |
libmount: add fallbacks for old systems without umount2() syscall
Reported-by: Peter Breitenlohner <peb@mppmu.mpg.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs')
-rw-r--r-- | shlibs/mount/src/context_umount.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/shlibs/mount/src/context_umount.c b/shlibs/mount/src/context_umount.c index bd9be6956..1187a87cd 100644 --- a/shlibs/mount/src/context_umount.c +++ b/shlibs/mount/src/context_umount.c @@ -21,6 +21,34 @@ #include "strutils.h" #include "mountP.h" +#if defined(MNT_FORCE) +/* Interesting ... it seems libc knows about MNT_FORCE and presumably + about umount2 as well -- need not do anything */ +#else /* MNT_FORCE */ +/* Does the present kernel source know about umount2? */ +# include <linux/unistd.h> +# ifdef __NR_umount2 +static int umount2(const char *path, int flags); +_syscall2(int, umount2, const char *, path, int, flags); +# else /* __NR_umount2 */ +static int +umount2(const char *path, int flags) { + fprintf(stderr, _("umount: compiled without support for -f\n")); + errno = ENOSYS; + return -1; +} +#endif /* __NR_umount2 */ +# if !defined(MNT_FORCE) +# define MNT_FORCE 1 +#endif + +#endif /* MNT_FORCE */ + +#if !defined(MNT_DETACH) +#define MNT_DETACH 2 +#endif + + static int lookup_umount_fs(struct libmnt_context *cxt) { int rc; |