X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Fmountlist.c;h=b839cd17f1831a9f5a5b7289a0b7cd2c063291d4;hb=d208f3ab64d5d5b70356ca61cc2d8d0373407a3c;hp=a9a9f2c7fa84fc4ee264095adbf9b591099bd59c;hpb=613bcb6205cf2b64d835c19074c5a7e7c6cb99eb;p=gnulib.git diff --git a/lib/mountlist.c b/lib/mountlist.c index a9a9f2c7f..b839cd17f 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -1,6 +1,6 @@ /* mountlist.c -- return a list of mounted file systems - Copyright (C) 1991-1992, 1997-2012 Free Software Foundation, Inc. + Copyright (C) 1991-1992, 1997-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -128,8 +128,12 @@ # include #endif +#ifndef HAVE_HASMNTOPT +# define hasmntopt(mnt, opt) ((char *) 0) +#endif + #undef MNT_IGNORE -#if defined MNTOPT_IGNORE && defined HAVE_HASMNTOPT +#ifdef MNTOPT_IGNORE # define MNT_IGNORE(M) hasmntopt (M, MNTOPT_IGNORE) #else # define MNT_IGNORE(M) 0 @@ -153,6 +157,15 @@ (strcmp (Fs_type, "autofs") == 0 \ || strcmp (Fs_type, "proc") == 0 \ || strcmp (Fs_type, "subfs") == 0 \ + /* for Linux 2.6/3.x */ \ + || strcmp (Fs_type, "debugfs") == 0 \ + || strcmp (Fs_type, "devpts") == 0 \ + || strcmp (Fs_type, "fusectl") == 0 \ + || strcmp (Fs_type, "mqueue") == 0 \ + || strcmp (Fs_type, "rpc_pipefs") == 0 \ + || strcmp (Fs_type, "sysfs") == 0 \ + /* FreeBSD, Linux 2.4 */ \ + || strcmp (Fs_type, "devfs") == 0 \ /* for NetBSD 3.0 */ \ || strcmp (Fs_type, "kernfs") == 0 \ /* for Irix 6.5 */ \ @@ -430,7 +443,7 @@ read_file_system_list (bool need_fs_type) me->me_mountdir = xstrdup (mnt->mnt_dir); me->me_type = xstrdup (mnt->mnt_type); me->me_type_malloced = 1; - me->me_dummy = ME_DUMMY (me->me_devname, me->me_type); + me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, mnt); me->me_remote = ME_REMOTE (me->me_devname, me->me_type); me->me_dev = dev_from_mount_options (mnt->mnt_opts); @@ -933,6 +946,7 @@ read_file_system_list (bool need_fs_type) mtail = &me->me_next; } } + closedir (dirp); } #endif /* MOUNTED_INTERIX_STATVFS */ @@ -948,11 +962,7 @@ read_file_system_list (bool need_fs_type) while (mount_list) { me = mount_list->me_next; - free (mount_list->me_devname); - free (mount_list->me_mountdir); - if (mount_list->me_type_malloced) - free (mount_list->me_type); - free (mount_list); + free_mount_entry (mount_list); mount_list = me; } @@ -960,3 +970,14 @@ read_file_system_list (bool need_fs_type) return NULL; } } + +/* Free a mount entry as returned from read_file_system_list (). */ + +void free_mount_entry (struct mount_entry *me) +{ + free (me->me_devname); + free (me->me_mountdir); + if (me->me_type_malloced) + free (me->me_type); + free (me); +}