]> err.no Git - util-linux/commitdiff
setarch: provide backwards compatibility
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 15 Apr 2008 23:26:56 +0000 (03:26 +0400)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Apr 2008 09:20:09 +0000 (11:20 +0200)
The getopt_long(3) use introduced by commit
8df90dec2bfd8c876ddd4cea010f40550d4e24aa
broke backwards compatibility.

Old behavior:
$ i386 uname -m
i686

New behavior:
$ i386 uname -m
i386: invalid option -- m
Linux

Traditional method to fix it is to disable program arguments reordering
by prefixing getopt_long's optstring with '+' character.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/setarch.c

index aa7c81097510ce410005fbeb9c124b7543a614bd..bc6a12d035ba980cd19acce9cfe62b0d9a0ebb7c 100644 (file)
@@ -236,7 +236,7 @@ int main(int argc, char *argv[])
    }
   #endif
 
-  while ((c = getopt_long(argc, argv, "hv3BFILRSTXZ", longopts, NULL)) != -1) {
+  while ((c = getopt_long(argc, argv, "+hv3BFILRSTXZ", longopts, NULL)) != -1) {
     switch (c) {
     case 'h':
       show_help();