Use setmntent() OR fopen()

For the same reasons it's used in libzfs_init(), this was just
overlooked because zinject gets minimal use.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #1498
This commit is contained in:
Turbo Fredriksson 2013-06-04 03:55:28 +02:00 committed by Brian Behlendorf
parent fb5c53ea65
commit f9e459d143
1 changed files with 4 additions and 0 deletions

View File

@ -115,7 +115,11 @@ parse_pathname(const char *inpath, char *dataset, char *relpath,
return (-1); return (-1);
} }
#ifdef HAVE_SETMNTENT
if ((fp = setmntent(MNTTAB, "r")) == NULL) {
#else
if ((fp = fopen(MNTTAB, "r")) == NULL) { if ((fp = fopen(MNTTAB, "r")) == NULL) {
#endif
(void) fprintf(stderr, "cannot open /etc/mtab\n"); (void) fprintf(stderr, "cannot open /etc/mtab\n");
return (-1); return (-1);
} }