Prechádzať zdrojové kódy

dpkg-deb: Force the ar member name to 16 space padded chars wide

This makes the code resilient to changes to the member name strings
and guarantees it will always have the valid length, also makes it
easier to refactor later on.
Guillem Jover 16 rokov pred
rodič
commit
3fe6efee7d
1 zmenil súbory, kde vykonal 5 pridanie a 3 odobranie
  1. 5 3
      dpkg-deb/build.c

+ 5 - 3
dpkg-deb/build.c

@@ -448,13 +448,15 @@ void do_build(const char *const *argv) {
     thetime = time(NULL);
     if (fprintf(ar,
                 "!<arch>\n"
-                DEBMAGIC "%-12lu0     0     100644  %-10ld`\n"
+                "%-16s%-12lu0     0     100644  %-10ld`\n"
                 ARCHIVEVERSION "\n"
                 "%s"
-                ADMINMEMBER "%-12lu0     0     100644  %-10ld`\n",
+                "%-16s%-12lu0     0     100644  %-10ld`\n",
+                DEBMAGIC,
                 thetime,
                 (long)sizeof(ARCHIVEVERSION),
                 (sizeof(ARCHIVEVERSION)&1) ? "\n" : "",
+                ADMINMEMBER,
                 (unsigned long)thetime,
                 (long)controlstab.st_size) == EOF)
       werr(debar);
@@ -557,7 +559,7 @@ void do_build(const char *const *argv) {
       ohshite(_("failed to fstat tmpfile (data)"));
     if (fprintf(ar,
                 "%s"
-                "%s" "%-12lu0     0     100644  %-10ld`\n",
+                "%-16s%-12lu0     0     100644  %-10ld`\n",
                 (controlstab.st_size & 1) ? "\n" : "",
                 datamember,
                 (unsigned long)thetime,