Deleted Added
full compact
getmntopts.c (186505) getmntopts.c (230226)
1/*-
2 * Copyright (c) 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

28 */
29
30#if 0
31#ifndef lint
32static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95";
33#endif /* not lint */
34#endif
35#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

28 */
29
30#if 0
31#ifndef lint
32static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95";
33#endif /* not lint */
34#endif
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/sbin/mount/getmntopts.c 186505 2008-12-26 22:55:38Z obrien $");
36__FBSDID("$FreeBSD: head/sbin/mount/getmntopts.c 230226 2012-01-16 19:34:21Z jh $");
37
38#include <sys/param.h>
39#include <sys/mount.h>
40#include <sys/stat.h>
41#include <sys/uio.h>
42
43#include <err.h>
44#include <errno.h>

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

119
120 /* remove trailing slash if necessary */
121 if (rrpout - rrpoutstart > 1 && *(rrpout - 1) == '/')
122 *(rrpout - 1) = '\0';
123 else
124 *rrpout = '\0';
125}
126
37
38#include <sys/param.h>
39#include <sys/mount.h>
40#include <sys/stat.h>
41#include <sys/uio.h>
42
43#include <err.h>
44#include <errno.h>

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

119
120 /* remove trailing slash if necessary */
121 if (rrpout - rrpoutstart > 1 && *(rrpout - 1) == '/')
122 *(rrpout - 1) = '\0';
123 else
124 *rrpout = '\0';
125}
126
127void
127int
128checkpath(const char *path, char *resolved)
129{
130 struct stat sb;
131
132 if (realpath(path, resolved) != NULL && stat(resolved, &sb) == 0) {
128checkpath(const char *path, char *resolved)
129{
130 struct stat sb;
131
132 if (realpath(path, resolved) != NULL && stat(resolved, &sb) == 0) {
133 if (!S_ISDIR(sb.st_mode))
134 errx(EX_USAGE, "%s: not a directory", resolved);
133 if (!S_ISDIR(sb.st_mode)) {
134 errno = ENOTDIR;
135 return (1);
136 }
135 } else
137 } else
136 errx(EX_USAGE, "%s: %s", resolved, strerror(errno));
138 return (1);
139
140 return (0);
137}
138
139void
140build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
141 size_t len)
142{
143 int i;
144

--- 38 unchanged lines hidden ---
141}
142
143void
144build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
145 size_t len)
146{
147 int i;
148

--- 38 unchanged lines hidden ---