Mercurial > hg > toybox
changeset 1320:b2cc738d3cfc draft
Add mount options to data getmountlist collects.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 27 May 2014 07:56:51 -0500 |
parents | 1fa185766188 |
children | 4d898affda0c |
files | lib/getmountlist.c lib/lib.h |
diffstat | 2 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/getmountlist.c Mon May 26 20:39:20 2014 -0500 +++ b/lib/getmountlist.c Tue May 27 07:56:51 2014 -0500 @@ -4,7 +4,6 @@ */ #include "toys.h" - #include <mntent.h> // Get list of mounted filesystems, including stat and statvfs info. @@ -25,17 +24,18 @@ for (mtlist = 0; (me = getmntent(fp)); mtlist = mt) { mt = xzalloc(sizeof(struct mtab_list) + strlen(me->mnt_fsname) + - strlen(me->mnt_dir) + strlen(me->mnt_type) + 3); + strlen(me->mnt_dir) + strlen(me->mnt_type) + strlen(me->mnt_opts) + 4); mt->next = mtlist; // Collect details about mounted filesystem (don't bother for /etc/fstab). - stat(me->mnt_dir, &(mt->stat)); - statvfs(me->mnt_dir, &(mt->statvfs)); + if (stat(me->mnt_dir, &(mt->stat)) || statvfs(me->mnt_dir, &(mt->statvfs))) + perror_msg("stat '%s'"); // Remember information from /proc/mounts - mt->dir = stpcpy(mt->type, me->mnt_type) + 1; - mt->device = stpcpy(mt->dir, me->mnt_dir) + 1; - strcpy(mt->device, me->mnt_fsname); + mt->dir = stpcpy(mt->type, me->mnt_type)+1; + mt->device = stpcpy(mt->dir, me->mnt_dir)+1; + mt->opts = stpcpy(mt->device, me->mnt_fsname)+1; + strcpy(mt->opts, me->mnt_opts); } endmntent(fp);