]> granicus.if.org Git - zfs/commitdiff
Use setmntent() OR fopen()
authorTurbo Fredriksson <turbo@bayour.com>
Tue, 4 Jun 2013 01:55:28 +0000 (03:55 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 15 Aug 2013 17:09:09 +0000 (10:09 -0700)
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

cmd/zinject/translate.c

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