aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-08-30 17:34:24 -0500
committerRob Landley <rob@landley.net>2013-08-30 17:34:24 -0500
commit42adb7a56ba7b251ebc0a2d7aced81d3be5342a3 (patch)
treecf43644ec155f8d233e78ae3af148d59defe17b9 /lib
parentd04dc1feb92a279e27e4487c502944f454d43837 (diff)
downloadtoybox-42adb7a56ba7b251ebc0a2d7aced81d3be5342a3.tar.gz
Allow getmountlist to read fstab too.
Diffstat (limited to 'lib')
-rw-r--r--lib/getmountlist.c5
-rw-r--r--lib/lib.h3
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/getmountlist.c b/lib/getmountlist.c
index 28a84063..c863de5d 100644
--- a/lib/getmountlist.c
+++ b/lib/getmountlist.c
@@ -10,13 +10,14 @@
// Get list of mounted filesystems, including stat and statvfs info.
// Returns a reversed list, which is good for finding overmounts and such.
-struct mtab_list *xgetmountlist(void)
+struct mtab_list *xgetmountlist(char *path)
{
struct mtab_list *mtlist, *mt;
struct mntent *me;
FILE *fp;
- if (!(fp = setmntent("/proc/mounts", "r"))) perror_exit("bad /proc/mounts");
+ if (!path) path = "/proc/mounts";
+ if (!(fp = setmntent(path, "r"))) perror_exit("bad %s", path);
// The "test" part of the loop is done before the first time through and
// again after each "increment", so putting the actual load there avoids
diff --git a/lib/lib.h b/lib/lib.h
index b7b10ff4..2294a5bf 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -162,7 +162,6 @@ void crc_init(unsigned int *crc_table, int little_endian);
void terminal_size(unsigned *x, unsigned *y);
int yesno(char *prompt, int def);
void for_each_pid_with_name_in(char **names, int (*callback)(pid_t pid, char *name));
-unsigned long xstrtoul(const char *nptr, char **endptr, int base);
// net.c
int xsocket(int domain, int type, int protocol);
@@ -177,7 +176,7 @@ struct mtab_list {
char type[0];
};
-struct mtab_list *xgetmountlist(void);
+struct mtab_list *xgetmountlist(char *path);
void bunzipStream(int src_fd, int dst_fd);