Forráskód Böngészése

libdpkg: Do not silently eat a standalone ‘-’ in the command-line parser

A single dash is commonly used to refer to standard input, and having
to use ‘--’ to stop the parser is very cumbersome. Besides, there's no
reason a standalone ‘-’ should be silently ignored.
Guillem Jover 11 éve
szülő
commit
7720ab4227
2 módosított fájl, 2 hozzáadás és 1 törlés
  1. 1 0
      debian/changelog
  2. 1 1
      lib/dpkg/options.c

+ 1 - 0
debian/changelog

@@ -66,6 +66,7 @@ dpkg (1.18.0) UNRELEASED; urgency=low
     from section 8 to 1, to match their installation path.
   * Trim end of line whitespace from dpkg and dselect config file parsers.
     Reported by Christoph Biedl <debian.axhn@manchmal.in-ulm.de>.
+  * Do not silently eat a standalone ‘-’ in the libdpkg command-line parser.
 
   [ Updated manpages translations ]
   * German (Helge Kreutzmann).

+ 1 - 1
lib/dpkg/options.c

@@ -221,7 +221,7 @@ dpkg_options_parse(const char *const **argvp, const struct cmdinfo *cmdinfos,
   printforhelp = help_str;
 
   ++(*argvp);
-  while ((p= **argvp) && *p == '-') {
+  while ((p = **argvp) && p[0] == '-' && p[1] != '\0') {
     ++(*argvp);
     if (strcmp(p, "--") == 0)
       break;