Mir

Merge lp:~vanvugt/mir/append-libpath into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 2251
Proposed branch: lp:~vanvugt/mir/append-libpath
Merge into: lp:mir
Diff against target: 35 lines (+16/-2)
1 file modified
src/wrapper.c (+16/-2)
To merge this branch: bzr merge lp:~vanvugt/mir/append-libpath
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+247255@code.launchpad.net

Commit message

wrapper: Append LD_LIBRARY_PATH instead of replacing it. This allows
deploy-and-test.sh to work correctly again. (LP: #1413479)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Sure

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wrapper.c'
2--- src/wrapper.c 2015-01-14 06:39:13 +0000
3+++ src/wrapper.c 2015-01-22 05:14:51 +0000
4@@ -21,6 +21,20 @@
5 #include <stdio.h>
6 #include <unistd.h>
7
8+static void appendenv(const char* varname, const char* append)
9+{
10+ char buf[1024] = "";
11+ const char* value = append;
12+ const char* old = getenv(varname);
13+ if (old != NULL)
14+ {
15+ snprintf(buf, sizeof(buf)-1, "%s:%s", old, append);
16+ buf[sizeof(buf)-1] = '\0';
17+ value = buf;
18+ }
19+ setenv(varname, value, 1);
20+}
21+
22 int main(int argc, char** argv)
23 {
24 char path[1024], *dest = path, *dest_max = path+sizeof(path)-1;
25@@ -48,8 +62,8 @@
26 printf("MIR_CLIENT_PLATFORM_PATH=%s\n", path);
27
28 pivot[6] = '\0'; /* truncate lib/client-modules to just lib */
29- setenv("LD_LIBRARY_PATH", path, 1);
30- printf("LD_LIBRARY_PATH=%s\n", path);
31+ appendenv("LD_LIBRARY_PATH", path);
32+ printf("LD_LIBRARY_PATH=%s\n", getenv("LD_LIBRARY_PATH"));
33
34 snprintf(pivot, pivot_max, EXECUTABLE_FORMAT, name);
35 *dest_max = '\0';

Subscribers

People subscribed via source and target branches