getfsent(): Read only six fields per line

The fs.fs_type is only for *BSD, we hard-code it to "rw"
in the meantime.  Should be safe in most cases.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-08-02 02:01:51 +02:00
parent d76ecad517
commit 1a8f1d9604
+6 -3
View File
@@ -274,12 +274,15 @@ struct fstab *getfsent(void)
static struct fstab fs;
fs.fs_spec = lftok(fstab);
if (fs.fs_spec == NULL)
return NULL;
fs.fs_file = lftok(fstab);
fs.fs_vfstype = lftok(fstab);
fs.fs_mntops = lftok(fstab);
fs.fs_type = (const char *)lftok(fstab);
fs.fs_freq = atoi(lftok(fstab) ?: 0);
fs.fs_passno = atoi(lftok(fstab) ?: 0);
fs.fs_type = "rw";
fs.fs_freq = atoi(lftok(fstab) ?: "0");
fs.fs_passno = atoi(lftok(fstab) ?: "0");
return &fs;
}