summaryrefslogtreecommitdiffstats
path: root/contrib/amd/libamu/mtab.c
diff options
context:
space:
mode:
authormbr <mbr@FreeBSD.org>2003-09-02 15:27:38 +0000
committermbr <mbr@FreeBSD.org>2003-09-02 15:27:38 +0000
commit7d0df748b4c59651751f156e408f856a02073b69 (patch)
tree4674a9f108ae4334ed6a61634f703f67f6533f4d /contrib/amd/libamu/mtab.c
parent532be24b7ef077cdfe0129dee60ab1f934c24181 (diff)
downloadFreeBSD-src-7d0df748b4c59651751f156e408f856a02073b69.zip
FreeBSD-src-7d0df748b4c59651751f156e408f856a02073b69.tar.gz
Virgin import of AMD (am-utils) 20030828 (6.0.9)
Diffstat (limited to 'contrib/amd/libamu/mtab.c')
-rw-r--r--contrib/amd/libamu/mtab.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/contrib/amd/libamu/mtab.c b/contrib/amd/libamu/mtab.c
index 1fb3a33..eab87b3 100644
--- a/contrib/amd/libamu/mtab.c
+++ b/contrib/amd/libamu/mtab.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2001 Erez Zadok
+ * Copyright (c) 1997-2003 Erez Zadok
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
@@ -38,7 +38,7 @@
*
* %W% (Berkeley) %G%
*
- * $Id: mtab.c,v 1.3.2.3 2001/04/14 21:08:25 ezk Exp $
+ * $Id: mtab.c,v 1.3.2.7 2002/12/27 22:45:12 ezk Exp $
*
*/
@@ -60,11 +60,11 @@ mnt_free(mntent_t *mp)
XFREE(mp->mnt_type);
XFREE(mp->mnt_opts);
-#ifdef HAVE_FIELD_MNTENT_T_MNT_TIME
-# ifdef HAVE_FIELD_MNTENT_T_MNT_TIME_STRING
+#ifdef HAVE_MNTENT_T_MNT_TIME
+# ifdef HAVE_MNTENT_T_MNT_TIME_STRING
XFREE(mp->mnt_time);
-# endif /* HAVE_FIELD_MNTENT_T_MNT_TIME_STRING */
-#endif /* HAVE_FIELD_MNTENT_T_MNT_TIME */
+# endif /* HAVE_MNTENT_T_MNT_TIME_STRING */
+#endif /* HAVE_MNTENT_T_MNT_TIME */
XFREE(mp);
}
@@ -154,22 +154,24 @@ hasmntval(mntent_t *mnt, char *opt)
if (eq) { /* and had an = after it */
char *endptr = NULL;
- long int i = strtol(eq,&endptr,0); /* hex and octal allowed ;-) */
+ long int i = strtol(eq, &endptr, 0); /* hex and octal allowed ;-) */
- if ( (! endptr) || /* endptr == NULL means all chars valid */
+ if (!endptr ||
/*
* endptr set means strtol saw a non-digit. If the
* non-digit is a comma, it's probably the start of the next
* option. If the comma is the first char though, complain about
* it (foo=,bar is made noticeable by this).
+ *
+ * Similar reasoning for '\0' instead of comma, it's the end
+ * of the string.
*/
- ((endptr == strchr(eq, ',')) && (endptr != eq))
- )
+ (endptr != eq && (*endptr == ',' || *endptr == '\0')))
return((int) i);
- /* whatever was after = wasn't a number */
+ /* whatever was after the '=' sign wasn't a number */
plog(XLOG_MAP, "invalid numeric option in \"%s\": \"%s\"", opt, str);
} else {
- /* No argument to option (= was missing) */
+ /* No argument to option ('=' sign was missing) */
plog(XLOG_MAP, "numeric option to \"%s\" missing", opt);
}
}
OpenPOWER on IntegriCloud