Explorar el Código

dpkg: Fix --add-architecture and --remove-architecture to take one argument

These commands take exactly one argument, check that and error out.

Closes: #757254
Guillem Jover hace 12 años
padre
commit
d6838f2dca
Se han modificado 2 ficheros con 6 adiciones y 4 borrados
  1. 2 0
      debian/changelog
  2. 4 4
      src/main.c

+ 2 - 0
debian/changelog

@@ -102,6 +102,8 @@ dpkg (1.17.11) UNRELEASED; urgency=low
     one of the build types excluding them.
   * Add new -g and -G options to dpkg-genchanges and dpkg-buildpackage for
     source plus arch-indep/specific builds. Closes: #756975
+  * Fix dpkg --add-architecture and --remove-architecture to check that they
+    get exactly one argument. Closes: #757254
 
   [ Updated programs translations ]
   * Danish (Joe Dalton). Closes: #754127

+ 4 - 4
src/main.c

@@ -498,8 +498,8 @@ arch_add(const char *const *argv)
   struct dpkg_arch *arch;
   const char *archname = *argv++;
 
-  if (archname == NULL)
-    badusage(_("--%s takes one argument"), cipaction->olong);
+  if (archname == NULL || *argv)
+    badusage(_("--%s takes exactly one argument"), cipaction->olong);
 
   dpkg_arch_load_list();
 
@@ -528,8 +528,8 @@ arch_remove(const char *const *argv)
   struct pkgiterator *iter;
   struct pkginfo *pkg;
 
-  if (archname == NULL)
-    badusage(_("--%s takes one argument"), cipaction->olong);
+  if (archname == NULL || *argv)
+    badusage(_("--%s takes exactly one argument"), cipaction->olong);
 
   modstatdb_open(msdbrw_readonly);