Package: zzuf
Version: 0.8.1-1
Severity: wishlist
Tags: patch

Hi,

I found it useful to allow preloading other libraries when using zzuf.
Here's a patch for that:

------------------------------------------------------------
diff -ur zzuf-0.8.1/src/zzuf.c zzuf-0.8.1.sli/src/zzuf.c
--- zzuf-0.8.1/src/zzuf.c       2007-03-02 01:51:54.000000000 +0200
+++ zzuf-0.8.1.sli/src/zzuf.c   2007-03-04 06:23:16.000000000 +0200
@@ -837,7 +837,7 @@
     char buf[64];
 #if defined HAVE_FORK
     static int const files[] = { DEBUG_FILENO, STDERR_FILENO, STDOUT_FILENO };
-    char *libpath, *tmp;
+    char *libpath, *tmp, *old_preload, *new_preload;
     int pid, j, len = strlen(opts->oldargv[0]);
 #   if defined __APPLE__
 #       define FILENAME "libzzuf.dylib"
@@ -910,10 +910,27 @@
 
     strcpy(tmp ? tmp + 1 : libpath, ".libs/" FILENAME EXTRAINFO);
     if(ret == 0)
-        setenv(PRELOAD, libpath, 1);
+    {
+       old_preload = getenv(PRELOAD);
+       new_preload = malloc(strlen(old_preload)+strlen(libpath)+2);
+       strcpy(new_preload, old_preload);
+       strcat(new_preload, ":");
+       strcat(new_preload, libpath);
+        setenv(PRELOAD, new_preload, 1);
+    }
     else
-        setenv(PRELOAD, LIBDIR "/" FILENAME EXTRAINFO, 1);
+    {
+       old_preload = getenv(PRELOAD);
+       new_preload =
+           malloc(strlen(old_preload)+
+                  strlen(LIBDIR "/" FILENAME EXTRAINFO)+2);
+       strcpy(new_preload, old_preload);
+       strcat(new_preload, ":");
+       strcat(new_preload, LIBDIR "/" FILENAME EXTRAINFO);
+       setenv(PRELOAD, new_preload, 1);
+    }
     free(libpath);
+    free(new_preload);
 
     if(execvp(opts->newargv[0], opts->newargv))
     {
------------------------------------------------------------

        Sami


-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-amd64
Locale: LANG=C, [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages zzuf depends on:
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries

zzuf recommends no packages.

-- no debconf information

Attachment: signature.asc
Description: Digital signature

Reply via email to