zfs: use getopt_long for mount.zfs.

This commit is contained in:
Christian Neukirchen 2016-01-14 14:02:21 +01:00
parent 389109c3db
commit 0203a5aa0f
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,25 @@
mount.zfs is called by convention (and util-linux) with arguments last, i.e.
% mount.zfs <dataset> <mountpoint> -o <options>
Use getopt_long so musl will permute arguments.
Passing 0 as long_opts is unspecified, but safe for glibc and musl getopt_long.
--- a/cmd/mount_zfs/mount_zfs.c 2016-01-14 13:55:43.352951688 +0100
+++ b/cmd/mount_zfs/mount_zfs.c 2016-01-14 13:53:35.685221569 +0100
@@ -33,6 +33,7 @@
#include <libzfs.h>
#include <locale.h>
#include <fcntl.h>
+#include <getopt.h>
#define ZS_COMMENT 0x00000000 /* comment */
#define ZS_ZFSUTIL 0x00000001 /* caller is zfs(8) */
@@ -390,7 +391,7 @@
opterr = 0;
/* check options */
- while ((c = getopt(argc, argv, "sfnvo:h?")) != -1) {
+ while ((c = getopt_long(argc, argv, "sfnvo:h?", 0, 0)) != -1) {
switch (c) {
case 's':
sloppy = 1;

View File

@ -1,7 +1,7 @@
# Template file for 'zfs'
pkgname=zfs
version=0.6.5.4
revision=3
revision=4
patch_args="-Np1"
wrksrc="${pkgname}-${pkgname}-${version/r/-}"
build_style=gnu-configure