summaryrefslogtreecommitdiff
path: root/sbin/mount_udf
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2013-04-12 20:48:55 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2013-04-12 20:48:55 +0000
commit69e6d7b75e96c406d072cb83ffc9b26fbf1a86fb (patch)
tree54038c9ac32a45f8741dcc23fb9a8ffc0e15ff89 /sbin/mount_udf
parent51048477bcc79bcc8753121ec91c150648df3d1b (diff)
parent8818042ff2ecd155adb5c248a22de2dbe5d9c2a9 (diff)
downloadsrc-test2-69e6d7b75e96c406d072cb83ffc9b26fbf1a86fb.tar.gz
src-test2-69e6d7b75e96c406d072cb83ffc9b26fbf1a86fb.zip
sync from head
Notes
Notes: svn path=/projects/bmake/; revision=249429
Diffstat (limited to 'sbin/mount_udf')
-rw-r--r--sbin/mount_udf/Makefile1
-rw-r--r--sbin/mount_udf/mount_udf.c46
2 files changed, 14 insertions, 33 deletions
diff --git a/sbin/mount_udf/Makefile b/sbin/mount_udf/Makefile
index c5351fdc8782..06ad9a768e4c 100644
--- a/sbin/mount_udf/Makefile
+++ b/sbin/mount_udf/Makefile
@@ -9,7 +9,6 @@ LDADD= -lkiconv
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
diff --git a/sbin/mount_udf/mount_udf.c b/sbin/mount_udf/mount_udf.c
index 8ee1286eea33..01fa44f50e44 100644
--- a/sbin/mount_udf/mount_udf.c
+++ b/sbin/mount_udf/mount_udf.c
@@ -73,18 +73,19 @@ void usage(void);
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, i, iovlen, mntflags, udf_flags, verbose;
- i = mntflags = opts = udf_flags = verbose = 0;
+ i = 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++;
@@ -120,32 +121,13 @@ main(int argc, char **argv)
*/
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)
err(1, "%s", dev);