diff options
author | joerg <joerg@pkgsrc.org> | 2008-07-27 16:22:53 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2008-07-27 16:22:53 +0000 |
commit | f1c3a17a422245fd3273e9238803039a92d16b19 (patch) | |
tree | b724f135ae17d6959bcb50226c19f137193ce6b4 | |
parent | 558bb392aa3b54316f777fa3c4f52e16a8ee8dad (diff) | |
download | pkgsrc-f1c3a17a422245fd3273e9238803039a92d16b19.tar.gz |
pkg_install-20080727:
When using the libnbcompat version of getopt, make sure to not use
optind = 0. For GNU getopt compatibility, it does a partial reset.
This fixes PR 39181.
-rw-r--r-- | pkgtools/pkg_install/files/admin/audit.c | 15 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/version.h | 4 |
2 files changed, 14 insertions, 5 deletions
diff --git a/pkgtools/pkg_install/files/admin/audit.c b/pkgtools/pkg_install/files/admin/audit.c index 64bd95c9f16..1c9fb888dcd 100644 --- a/pkgtools/pkg_install/files/admin/audit.c +++ b/pkgtools/pkg_install/files/admin/audit.c @@ -1,4 +1,4 @@ -/* $NetBSD: audit.c,v 1.8.2.1 2008/05/12 12:12:07 joerg Exp $ */ +/* $NetBSD: audit.c,v 1.8.2.2 2008/07/27 16:22:53 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -8,7 +8,7 @@ #include <sys/cdefs.h> #endif #ifndef lint -__RCSID("$NetBSD: audit.c,v 1.8.2.1 2008/05/12 12:12:07 joerg Exp $"); +__RCSID("$NetBSD: audit.c,v 1.8.2.2 2008/07/27 16:22:53 joerg Exp $"); #endif /*- @@ -87,7 +87,14 @@ parse_options(int argc, char **argv) int ch; optreset = 1; - optind = 0; + /* + * optind == 0 is interpreted as partial reset request + * by GNU getopt, so compensate against this and cleanup + * at the end. + */ + optind = 1; + ++argc; + --argv; while ((ch = getopt(argc, argv, "est:")) != -1) { switch (ch) { @@ -105,6 +112,8 @@ parse_options(int argc, char **argv) /* NOTREACHED */ } } + + --optind; /* See above comment. */ } static int diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h index 9e254b1732f..aa232e579c4 100644 --- a/pkgtools/pkg_install/files/lib/version.h +++ b/pkgtools/pkg_install/files/lib/version.h @@ -1,4 +1,4 @@ -/* $NetBSD: version.h,v 1.102.2.9 2008/07/18 19:48:41 joerg Exp $ */ +/* $NetBSD: version.h,v 1.102.2.10 2008/07/27 16:22:53 joerg Exp $ */ /* * Copyright (c) 2001 Thomas Klausner. All rights reserved. @@ -27,6 +27,6 @@ #ifndef _INST_LIB_VERSION_H_ #define _INST_LIB_VERSION_H_ -#define PKGTOOLS_VERSION "20080718" +#define PKGTOOLS_VERSION "20080727" #endif /* _INST_LIB_VERSION_H_ */ |