Mercurial > hg > toybox
comparison lib/getmountlist.c @ 901:c44dff160d65
Silence warning and comment a subtle bit.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 14 May 2013 20:22:23 -0500 |
parents | 849e14fecf2b |
children | 11cf9b97fae7 |
comparison
equal
deleted
inserted
replaced
900:edd8e6fd418d | 901:c44dff160d65 |
---|---|
16 struct mntent *me; | 16 struct mntent *me; |
17 FILE *fp; | 17 FILE *fp; |
18 | 18 |
19 if (!(fp = setmntent("/proc/mounts", "r"))) perror_exit("bad /proc/mounts"); | 19 if (!(fp = setmntent("/proc/mounts", "r"))) perror_exit("bad /proc/mounts"); |
20 | 20 |
21 for (mtlist = 0; me = getmntent(fp); mtlist = mt) { | 21 // The "test" part of the loop is done before the first time through and |
22 // again after each "increment", so putting the actual load there avoids | |
23 // duplicating it. If the load was NULL, the loop stops. | |
24 | |
25 for (mtlist = 0; (me = getmntent(fp)); mtlist = mt) { | |
22 mt = xzalloc(sizeof(struct mtab_list) + strlen(me->mnt_fsname) + | 26 mt = xzalloc(sizeof(struct mtab_list) + strlen(me->mnt_fsname) + |
23 strlen(me->mnt_dir) + strlen(me->mnt_type) + 3); | 27 strlen(me->mnt_dir) + strlen(me->mnt_type) + 3); |
24 mt->next = mtlist; | 28 mt->next = mtlist; |
25 | 29 |
26 // Collect details about mounted filesystem (don't bother for /etc/fstab). | 30 // Collect details about mounted filesystem (don't bother for /etc/fstab). |