mount: style fixes

This commit is contained in:
Denis Vlasenko 2006-09-17 15:00:58 +00:00
parent 66fabdb631
commit 8d474b5009

View File

@ -167,7 +167,8 @@ static llist_t *get_block_backed_filesystems(void)
FILE *f; FILE *f;
for (i = 0; filesystems[i]; i++) { for (i = 0; filesystems[i]; i++) {
if(!(f = fopen(filesystems[i], "r"))) continue; f = fopen(filesystems[i], "r");
if (!f) continue;
for (fs = buf = 0; (fs = buf = bb_get_chomped_line_from_file(f)); for (fs = buf = 0; (fs = buf = bb_get_chomped_line_from_file(f));
free(buf)) free(buf))
@ -206,11 +207,12 @@ static int fakeIt;
#endif #endif
// Perform actual mount of specific filesystem at specific location. // Perform actual mount of specific filesystem at specific location.
// NB: mp->xxx fields may be trashed on exit
static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts) static int mount_it_now(struct mntent *mp, int vfsflags, char *filteropts)
{ {
int rc; int rc;
if (fakeIt) { return 0; } if (fakeIt) return 0;
// Mount, with fallback to read-only if necessary. // Mount, with fallback to read-only if necessary.
@ -440,7 +442,6 @@ enum {
#endif #endif
}; };
/* /*
* We want to be able to compile mount on old kernels in such a way * We want to be able to compile mount on old kernels in such a way
* that the binary will work well on more recent kernels. * that the binary will work well on more recent kernels.
@ -1385,7 +1386,8 @@ static int singlemount(struct mntent *mp, int ignore_busy)
for (fl = fslist; fl; fl = fl->link) { for (fl = fslist; fl; fl = fl->link) {
mp->mnt_type = fl->data; mp->mnt_type = fl->data;
if (!(rc = mount_it_now(mp,vfsflags, filteropts))) break; rc = mount_it_now(mp,vfsflags, filteropts);
if (!rc) break;
mp->mnt_type = 0; mp->mnt_type = 0;
} }
@ -1521,14 +1523,15 @@ int mount_main(int argc, char **argv)
fstabname = bb_path_mtab_file; fstabname = bb_path_mtab_file;
else fstabname="/etc/fstab"; else fstabname="/etc/fstab";
if (!(fstab=setmntent(fstabname,"r"))) fstab = setmntent(fstabname,"r");
if (!fstab)
bb_perror_msg_and_die("cannot read %s",fstabname); bb_perror_msg_and_die("cannot read %s",fstabname);
// Loop through entries until we find what we're looking for. // Loop through entries until we find what we're looking for.
memset(mtpair,0,sizeof(mtpair)); memset(mtpair,0,sizeof(mtpair));
for (;;) { for (;;) {
struct mntent *mtnext = mtpair + (mtcur==mtpair ? 1 : 0); struct mntent *mtnext = (mtcur==mtpair ? mtpair+1 : mtpair);
// Get next fstab entry // Get next fstab entry