[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] dpkg --info <two_or_more_deb_files> returns garbage



tags 35573 +patch
thanks

Patch is against dpkg 1.9.21, and works for me.

--- info.c	23 Apr 2001 20:42:17 -0000	1.11
+++ info.c	15 Nov 2002 10:14:57 -0000
@@ -84,11 +84,24 @@
 static void info_spew(const char *debar, const char *directory,
                       const char *const *argv) {
   const char *component;
+	long int pathlen;
+	char *controlfile = NULL;
   FILE *co;
   int re= 0;
 
   while ((component= *argv++) != 0) {
-    co= fopen(component,"r");
+		pathlen = strlen(directory) +
+			strlen(component) +
+			2;
+		controlfile = (void *) realloc((void *) controlfile, pathlen);
+		if (!controlfile)
+			ohshite(_("realloc failed (%ld bytes)"), pathlen);
+		bzero(controlfile, sizeof(controlfile));
+
+		strcat(controlfile, directory);
+		strcat(controlfile, "/");
+		strcat(controlfile, component);
+    co= fopen(controlfile,"r");
     if (co) {
       stream_fd_copy(co, 1, -1, _("info_spew"));
     } else if (errno == ENOENT) {
@@ -101,6 +114,7 @@
     }
   }
   if (re) ohshit(_("at least one requested control component missing"));
+	free(controlfile);
 }
 
 static void info_list(const char *debar, const char *directory) {

-- 
"das ist liebe, das ist hass / mit eifersucht vermahlen"



Reply to: