]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
mount.zfs: use getopt_long instead of getopt to guarantee permutation of argv.
authorChristian Neukirchen <chneukirchen@gmail.com>
Sat, 23 Jan 2016 20:37:35 +0000 (21:37 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 25 Jan 2016 21:17:18 +0000 (13:17 -0800)
commitd93b45aefc74b9c345ba3cdf3a227ee979a990cd
treed7f36bad12f4a2a6c3ba7b69d47ab1c60a0e691d
parent91d888437f729e0dce042d49b36063affb4f3af9
mount.zfs: use getopt_long instead of getopt to guarantee permutation of argv.

mount.zfs is called by convention (and util-linux) with arguments
last, i.e.

  % mount.zfs <dataset> <mountpoint> -o <options>

This is not a problem on glibc since GNU getopt(3) will reorder the
arguments.  However, alternative libc such as musl libc (or glibc with
$POSIXLY_CORRECT set) will not permute argv and fail to parse the -o
<options>.  Use getopt_long so musl will permute arguments.

Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4222
cmd/mount_zfs/mount_zfs.c