[ltrace-commits] 01/01: Do not assume prefix of /usr/share in system_call_params.exp
Petr Machata
pmachata-guest at moszumanska.debian.org
Tue Mar 3 10:58:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
pmachata-guest pushed a commit to branch master
in repository ltrace.
commit 1c468a7ce030c9a1528414d63c94530da6b61538
Author: Petr Machata <pmachata at redhat.com>
Date: Tue Mar 3 11:57:01 2015 +0100
Do not assume prefix of /usr/share in system_call_params.exp
---
testsuite/Makefile.am | 2 ++
testsuite/ltrace.main/system_call_params.exp | 14 ++++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index d999b2e..142f57a 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -1,3 +1,4 @@
+# Copyright (C) 2015 Petr Machata, Red Hat Inc.
# Copyright (C) 1992 - 2001 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -40,6 +41,7 @@ env.exp: Makefile
echo set libelf_LD_LIBRARY_PATH '"$(libelf_LD_LIBRARY_PATH)"' >> $@
echo set elfutils_LD_LIBRARY_PATH '"$(elfutils_LD_LIBRARY_PATH)"' >> $@
echo set libunwind_LD_LIBRARY_PATH '"$(libunwind_LD_LIBRARY_PATH)"' >> $@
+ echo set PREFIX '"$(prefix)"' >> $@
CLEANFILES = *.o *.so *.log *.sum *.ltrace site.bak setval.tmp site.exp env.exp
diff --git a/testsuite/ltrace.main/system_call_params.exp b/testsuite/ltrace.main/system_call_params.exp
index 4eade10..90d2c86 100644
--- a/testsuite/ltrace.main/system_call_params.exp
+++ b/testsuite/ltrace.main/system_call_params.exp
@@ -67,7 +67,8 @@ set conf [ltraceNamedSource "$dir/syscalls.conf" {
# system with the right prefix. So first compile a wrapper that we
# use to redirect fopen calls.
-set libfopen_so [ltraceCompile libfopen.so -ldl [ltraceSource c {
+set libfopen_so [ltraceCompile libfopen.so -ldl \
+ [ltraceSource c [string map [list "@PREFIX@" "$PREFIX"] {
#define _GNU_SOURCE
#include <dlfcn.h>
#include <stdio.h>
@@ -76,13 +77,14 @@ set libfopen_so [ltraceCompile libfopen.so -ldl [ltraceSource c {
FILE *
fopen(const char *path, const char *mode)
{
- if (strncmp(path, "/usr/share", 10) == 0)
- path = "/dev/null";
+ #define PATH "@PREFIX@/share"
+ if (strncmp(path, PATH, sizeof(PATH) - 1) == 0)
+ path = "/dev/null";
- return ((FILE *(*)(const char *, const char *))
- dlsym(RTLD_NEXT, "fopen")) (path, mode);
+ return ((FILE *(*)(const char *, const char *))
+ dlsym(RTLD_NEXT, "fopen")) (path, mode);
}
-}]]
+}]]]
setenv LD_PRELOAD $libfopen_so
ltraceMatch1 [ltraceRun -L -S -F $conf -- $bin] {^open at SYS\("/some/path"} == 0
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/ltrace.git
More information about the ltrace-commits
mailing list