HomeFreeBSD

mount.zfs: use getopt_long instead of getopt to guarantee permutation of argv.

Description

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

Details

Provenance
Christian Neukirchen <chneukirchen@gmail.com>Authored on Jan 23 2016, 8:37 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jan 25 2016, 9:17 PM
Parents
rG91d888437f72: Illumos 6451 - ztest fails due to checksum errors
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGd93b45aefc74: mount.zfs: use getopt_long instead of getopt to guarantee permutation of argv. (authored by Christian Neukirchen <chneukirchen@gmail.com>).Jan 25 2016, 9:17 PM