Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37039443
en ru br
ALT Linux repositórios
S:1.18-alt1
5.0: 1.14-alt4
4.1: 1.14-alt2
4.0: 1.7-alt16
3.0: 1.7-alt13

Group :: Sistema/Bibliotecas
RPM: libpopt

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: popt-1.18-alt-poptBadOption.patch
Download


diff --git a/popt/src/popt.c b/popt/src/popt.c
index 2db2bbd..f93971e 100644
--- a/popt/src/popt.c
+++ b/popt/src/popt.c
@@ -1602,20 +1602,23 @@ int poptAddItem(poptContext con, poptItem newItem, int flags)
 
 const char * poptBadOption(poptContext con, unsigned int flags)
 {
-    struct optionStackEntry * os = NULL;
-    const char *badOpt = NULL;
-
-    if (con != NULL) {
-       /* Stupid hack to return something semi-meaningful from exec failure */
-       if (con->execFail) {
-           badOpt = con->execFail;
-       } else {
-           os = (flags & POPT_BADOPTION_NOALIAS) ? con->optionStack : con->os;
-           badOpt = os->argv[os->next - 1];
-       }
-    }
+    struct optionStackEntry * os;
+
+    if (!con)
+	return NULL;
+
+    /* Stupid hack to return something semi-meaningful from exec failure */
+    if (con->execFail)
+	return con->execFail;
+
+    os = (flags & POPT_BADOPTION_NOALIAS) ? con->optionStack : con->os;
+    if (!os)
+	return NULL;
+
+    if (con->doExec && con->doExec->argv && !os->nextCharArg && os->next == os->argc)
+	return con->doExec->argv[0];
 
-    return badOpt;
+    return ((os->argv && (os->next > 0)) ? os->argv[os->next - 1] : NULL);
 }
 
 const char * poptStrerror(const int error)
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009