The following commit has been merged in the master branch:
commit 96fee44416027be3b9e60d8ec58fd072c143f83a
Author: Guillem Jover <[email protected]>
Date:   Wed Apr 14 13:39:56 2010 +0200

    dpkg: Factor out extension into its own variable in enqueue_specified()

diff --git a/src/packages.c b/src/packages.c
index 392001a..b3cfe2f 100644
--- a/src/packages.c
+++ b/src/packages.c
@@ -100,16 +100,16 @@ static void
 enqueue_specified(const char *const *argv)
 {
   const char *thisarg;
-  size_t l;
 
   while ((thisarg = *argv++) != NULL) {
     struct pkginfo *pkg;
 
     pkg = findpackage(thisarg);
     if (pkg->status == stat_notinstalled) {
-      l = strlen(pkg->name);
+      size_t l = strlen(pkg->name);
+      const char *extension = pkg->name + l - sizeof(DEBEXT) + 1;
 
-      if (l >= sizeof(DEBEXT) && !strcmp(pkg->name+l-sizeof(DEBEXT)+1,DEBEXT))
+      if (l >= sizeof(DEBEXT) && strcmp(extension, DEBEXT) == 0)
         badusage(_("you must specify packages by their own names,"
                    " not by quoting the names of the files they come in"));
     }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to