void-packages/srcpkgs/zfs/patches/musl-getopt.patch
Christian Neukirchen b58ce0530b zfs: fix patch order.
2016-01-14 14:12:08 +01:00

25 lines
819 B
Diff

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;