[Midnightbsd-cvs] src [11108] trunk/sbin/mount_udf/mount_udf.c: sync udf mount with freebsd
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Tue Jun 19 14:41:26 EDT 2018
Revision: 11108
http://svnweb.midnightbsd.org/src/?rev=11108
Author: laffer1
Date: 2018-06-19 14:41:25 -0400 (Tue, 19 Jun 2018)
Log Message:
-----------
sync udf mount with freebsd
Modified Paths:
--------------
trunk/sbin/mount_udf/Makefile
trunk/sbin/mount_udf/mount_udf.8
trunk/sbin/mount_udf/mount_udf.c
Property Changed:
----------------
trunk/sbin/mount_udf/mount_udf.8
Modified: trunk/sbin/mount_udf/Makefile
===================================================================
--- trunk/sbin/mount_udf/Makefile 2018-06-19 18:40:34 UTC (rev 11107)
+++ trunk/sbin/mount_udf/Makefile 2018-06-19 18:41:25 UTC (rev 11108)
@@ -1,4 +1,5 @@
# $MidnightBSD$
+# $FreeBSD: stable/10/sbin/mount_udf/Makefile 247861 2013-03-06 00:36:33Z jkim $
PROG= mount_udf
SRCS= mount_udf.c getmntopts.c
@@ -9,7 +10,6 @@
MOUNT= ${.CURDIR}/../mount
CFLAGS+= -I${MOUNT} -I${.CURDIR}/../../sys
.PATH: ${MOUNT}
-WARNS?= 1
# Needs to be dynamically linked for optional dlopen() access to
# userland libiconv
Modified: trunk/sbin/mount_udf/mount_udf.8
===================================================================
--- trunk/sbin/mount_udf/mount_udf.8 2018-06-19 18:40:34 UTC (rev 11107)
+++ trunk/sbin/mount_udf/mount_udf.8 2018-06-19 18:41:25 UTC (rev 11108)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\" Copyright (c) 2002
.\" Scott Long <scottl at FreeBSD.org>
.\" Jeroen Ruigrok van der Werven <asmodai at wxs.nl>
@@ -24,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/sbin/mount_udf/mount_udf.8 141611 2005-02-10 09:19:34Z ru $
.\"
.Dd March 23, 2002
.Dt MOUNT_UDF 8
Property changes on: trunk/sbin/mount_udf/mount_udf.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sbin/mount_udf/mount_udf.c
===================================================================
--- trunk/sbin/mount_udf/mount_udf.c 2018-06-19 18:40:34 UTC (rev 11107)
+++ trunk/sbin/mount_udf/mount_udf.c 2018-06-19 18:41:25 UTC (rev 11108)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1992, 1993, 1994
* The Regents of the University of California. All rights reserved.
@@ -32,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sbin/mount_udf/mount_udf.c 261741 2014-02-11 08:20:45Z brueffer $
*/
/*
@@ -61,7 +62,7 @@
#include "mntopts.h"
-struct mntopt mopts[] = {
+static struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_UPDATE,
MOPT_END
@@ -73,18 +74,19 @@
int
main(int argc, char **argv)
{
- struct iovec iov[12];
- int ch, i, mntflags, opts, udf_flags;
- char *dev, *dir, mntpath[MAXPATHLEN];
- char *cs_disk, *cs_local;
- int verbose;
+ char mntpath[MAXPATHLEN];
+ char fstype[] = "udf";
+ struct iovec *iov;
+ char *cs_disk, *cs_local, *dev, *dir;
+ int ch, iovlen, mntflags, udf_flags, verbose;
- i = mntflags = opts = udf_flags = verbose = 0;
+ iovlen = mntflags = udf_flags = verbose = 0;
cs_disk = cs_local = NULL;
+ iov = NULL;
while ((ch = getopt(argc, argv, "o:vC:")) != -1)
switch (ch) {
case 'o':
- getmntopts(optarg, mopts, &mntflags, &opts);
+ getmntopts(optarg, mopts, &mntflags, NULL);
break;
case 'v':
verbose++;
@@ -111,7 +113,8 @@
* Resolve the mountpoint with realpath(3) and remove unnecessary
* slashes from the devicename if there are any.
*/
- (void)checkpath(dir, mntpath);
+ if (checkpath(dir, mntpath) != 0)
+ err(EX_USAGE, "%s", mntpath);
(void)rmslashes(dev, dev);
/*
@@ -119,34 +122,15 @@
*/
mntflags |= MNT_RDONLY;
- iov[i].iov_base = "fstype";
- iov[i++].iov_len = sizeof("fstype");
- iov[i].iov_base = "udf";
- iov[i].iov_len = strlen(iov[i].iov_base) + 1;
- i++;
- iov[i].iov_base = "fspath";
- iov[i++].iov_len = sizeof("fspath");
- iov[i].iov_base = mntpath;
- iov[i++].iov_len = strlen(mntpath) + 1;
- iov[i].iov_base = "from";
- iov[i++].iov_len = sizeof("from");
- iov[i].iov_base = dev;
- iov[i++].iov_len = strlen(dev) + 1;
- iov[i].iov_base = "flags";
- iov[i++].iov_len = sizeof("flags");
- iov[i].iov_base = &udf_flags;
- iov[i++].iov_len = sizeof(udf_flags);
+ build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
+ build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1);
+ build_iovec(&iov, &iovlen, "from", dev, (size_t)-1);
+ build_iovec(&iov, &iovlen, "flags", &udf_flags, sizeof(udf_flags));
if (udf_flags & UDFMNT_KICONV) {
- iov[i].iov_base = "cs_disk";
- iov[i++].iov_len = sizeof("cs_disk");
- iov[i].iov_base = cs_disk;
- iov[i++].iov_len = strlen(cs_disk) + 1;
- iov[i].iov_base = "cs_local";
- iov[i++].iov_len = sizeof("cs_local");
- iov[i].iov_base = cs_local;
- iov[i++].iov_len = strlen(cs_local) + 1;
+ build_iovec(&iov, &iovlen, "cs_disk", cs_disk, (size_t)-1);
+ build_iovec(&iov, &iovlen, "cs_local", cs_local, (size_t)-1);
}
- if (nmount(iov, i, mntflags) < 0)
+ if (nmount(iov, iovlen, mntflags) < 0)
err(1, "%s", dev);
exit(0);
}
More information about the Midnightbsd-cvs
mailing list