Deleted Added
full compact
mtab.c (82794) mtab.c (119679)
1/*
1/*
2 * Copyright (c) 1997-2001 Erez Zadok
2 * Copyright (c) 1997-2003 Erez Zadok
3 * Copyright (c) 1989 Jan-Simon Pendry
4 * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
5 * Copyright (c) 1989 The Regents of the University of California.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Jan-Simon Pendry at Imperial College, London.
10 *

--- 22 unchanged lines hidden (view full) ---

33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * %W% (Berkeley) %G%
40 *
3 * Copyright (c) 1989 Jan-Simon Pendry
4 * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
5 * Copyright (c) 1989 The Regents of the University of California.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Jan-Simon Pendry at Imperial College, London.
10 *

--- 22 unchanged lines hidden (view full) ---

33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * %W% (Berkeley) %G%
40 *
41 * $Id: mtab.c,v 1.3.2.3 2001/04/14 21:08:25 ezk Exp $
41 * $Id: mtab.c,v 1.3.2.7 2002/12/27 22:45:12 ezk Exp $
42 *
43 */
44
45#ifdef HAVE_CONFIG_H
46# include <config.h>
47#endif /* HAVE_CONFIG_H */
48#include <am_defs.h>
49#include <amu.h>

--- 5 unchanged lines hidden (view full) ---

55void
56mnt_free(mntent_t *mp)
57{
58 XFREE(mp->mnt_fsname);
59 XFREE(mp->mnt_dir);
60 XFREE(mp->mnt_type);
61 XFREE(mp->mnt_opts);
62
42 *
43 */
44
45#ifdef HAVE_CONFIG_H
46# include <config.h>
47#endif /* HAVE_CONFIG_H */
48#include <am_defs.h>
49#include <amu.h>

--- 5 unchanged lines hidden (view full) ---

55void
56mnt_free(mntent_t *mp)
57{
58 XFREE(mp->mnt_fsname);
59 XFREE(mp->mnt_dir);
60 XFREE(mp->mnt_type);
61 XFREE(mp->mnt_opts);
62
63#ifdef HAVE_FIELD_MNTENT_T_MNT_TIME
64# ifdef HAVE_FIELD_MNTENT_T_MNT_TIME_STRING
63#ifdef HAVE_MNTENT_T_MNT_TIME
64# ifdef HAVE_MNTENT_T_MNT_TIME_STRING
65 XFREE(mp->mnt_time);
65 XFREE(mp->mnt_time);
66# endif /* HAVE_FIELD_MNTENT_T_MNT_TIME_STRING */
67#endif /* HAVE_FIELD_MNTENT_T_MNT_TIME */
66# endif /* HAVE_MNTENT_T_MNT_TIME_STRING */
67#endif /* HAVE_MNTENT_T_MNT_TIME */
68
69 XFREE(mp);
70}
71
72
73/*
74 * Discard memory allocated for mount list
75 */

--- 73 unchanged lines hidden (view full) ---

149
150 if (str) { /* The option was there */
151
152 char *eq = hasmnteq(mnt, opt);
153
154 if (eq) { /* and had an = after it */
155
156 char *endptr = NULL;
68
69 XFREE(mp);
70}
71
72
73/*
74 * Discard memory allocated for mount list
75 */

--- 73 unchanged lines hidden (view full) ---

149
150 if (str) { /* The option was there */
151
152 char *eq = hasmnteq(mnt, opt);
153
154 if (eq) { /* and had an = after it */
155
156 char *endptr = NULL;
157 long int i = strtol(eq,&endptr,0); /* hex and octal allowed ;-) */
157 long int i = strtol(eq, &endptr, 0); /* hex and octal allowed ;-) */
158
158
159 if ( (! endptr) || /* endptr == NULL means all chars valid */
159 if (!endptr ||
160 /*
161 * endptr set means strtol saw a non-digit. If the
162 * non-digit is a comma, it's probably the start of the next
163 * option. If the comma is the first char though, complain about
164 * it (foo=,bar is made noticeable by this).
160 /*
161 * endptr set means strtol saw a non-digit. If the
162 * non-digit is a comma, it's probably the start of the next
163 * option. If the comma is the first char though, complain about
164 * it (foo=,bar is made noticeable by this).
165 *
166 * Similar reasoning for '\0' instead of comma, it's the end
167 * of the string.
165 */
168 */
166 ((endptr == strchr(eq, ',')) && (endptr != eq))
167 )
169 (endptr != eq && (*endptr == ',' || *endptr == '\0')))
168 return((int) i);
170 return((int) i);
169 /* whatever was after = wasn't a number */
171 /* whatever was after the '=' sign wasn't a number */
170 plog(XLOG_MAP, "invalid numeric option in \"%s\": \"%s\"", opt, str);
171 } else {
172 plog(XLOG_MAP, "invalid numeric option in \"%s\": \"%s\"", opt, str);
173 } else {
172 /* No argument to option (= was missing) */
174 /* No argument to option ('=' sign was missing) */
173 plog(XLOG_MAP, "numeric option to \"%s\" missing", opt);
174 }
175 }
176 return 0;
177}
175 plog(XLOG_MAP, "numeric option to \"%s\" missing", opt);
176 }
177 }
178 return 0;
179}