[PC-BSD Commits] r20672 - pcbsd/current/src-sh/pbi-manager/wrapper

svn at pcbsd.org svn at pcbsd.org
Tue Dec 18 10:15:19 PST 2012


Author: kris
Date: 2012-12-18 18:15:19 +0000 (Tue, 18 Dec 2012)
New Revision: 20672

Modified:
   pcbsd/current/src-sh/pbi-manager/wrapper/main.c
Log:

Fix the wrapper binary, now set a new targv variable, and reset
the argv[0] value to the correct binary. Fixes issues with 
firefox and maybe others that check the binary path to load files



Modified: pcbsd/current/src-sh/pbi-manager/wrapper/main.c
===================================================================
--- pcbsd/current/src-sh/pbi-manager/wrapper/main.c	2012-12-18 18:13:19 UTC (rev 20671)
+++ pcbsd/current/src-sh/pbi-manager/wrapper/main.c	2012-12-18 18:15:19 UTC (rev 20672)
@@ -145,5 +145,17 @@
     //printf( "LDPATH: %s\n", newlibdir);
     //printf( "Running: %s \n", newtarget);
     //return system(newtarget);
-    return execv(newtarget, argv);
+    //strncpy(argv[0], newtarget);
+
+    // Build new target argv
+    char *targv[argc+1];
+    targv[0] = newtarget;
+    int i=1;
+    while(i < argc){
+      targv[i] = argv[i];
+      i++;
+    }
+    targv[i] = '\0';
+
+    return execv(newtarget, targv);
 }



More information about the Commits mailing list