mirror of https://github.com/MidnightCommander/mc
Sync with gnulib a3d1c7849936e481ae10dea5312a36a448a5d5bf.
src/filemanager/mountlist.c: use Linux code on Android. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
5505ed054d
commit
1c621d1a86
|
@ -1,4 +1,4 @@
|
|||
# serial 37
|
||||
# serial 38
|
||||
# How to list mounted file systems.
|
||||
|
||||
# Copyright (C) 1998-2004, 2006, 2009-2018 Free Software Foundation, Inc.
|
||||
|
@ -123,7 +123,7 @@ $ac_includes_default
|
|||
[Define if there is a function named getmntent for reading the list
|
||||
of mounted file systems, and that function takes a single argument.
|
||||
(4.3BSD, SunOS, HP-UX, Irix)])
|
||||
AC_CHECK_FUNCS([hasmntopt])
|
||||
AC_CHECK_FUNCS([setmntent endmntent hasmntopt])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -140,6 +140,15 @@
|
|||
#include <sys/mntent.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOUNTED_GETMNTENT1
|
||||
#if !HAVE_SETMNTENT /* Android <= 4.4 */
|
||||
#define setmntent(fp,mode) fopen (fp, mode)
|
||||
#endif
|
||||
#if !HAVE_ENDMNTENT /* Android <= 4.4 */
|
||||
#define endmntent(fp) fclose (fp)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_HASMNTOPT
|
||||
#define hasmntopt(mnt, opt) ((char *) 0)
|
||||
#endif
|
||||
|
@ -555,7 +564,7 @@ dev_from_mount_options (char const *mount_options)
|
|||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
#if defined MOUNTED_GETMNTENT1 && defined __linux__ /* GNU/Linux, Android */
|
||||
#if defined MOUNTED_GETMNTENT1 && (defined __linux__ || defined __ANDROID__) /* GNU/Linux, Android */
|
||||
|
||||
/* Unescape the paths in mount tables.
|
||||
STR is updated in place. */
|
||||
|
@ -598,7 +607,7 @@ read_file_system_list (void)
|
|||
{
|
||||
FILE *fp;
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined __linux__ || defined __ANDROID__
|
||||
/* Try parsing mountinfo first, as that make device IDs available.
|
||||
Note we could use libmount routines to simplify this parsing a little
|
||||
(and that code is in previous versions of this function), however
|
||||
|
@ -686,7 +695,7 @@ read_file_system_list (void)
|
|||
goto free_then_fail;
|
||||
}
|
||||
else /* fallback to /proc/self/mounts (/etc/mtab). */
|
||||
#endif /* __linux __ */
|
||||
#endif /* __linux __ || __ANDROID__ */
|
||||
{
|
||||
struct mntent *mnt;
|
||||
const char *table = MOUNTED;
|
||||
|
|
Loading…
Reference in New Issue