Commit 11ca757f authored by Petr Machata's avatar Petr Machata Committed by Petr Machata

Do not assume prefix of /usr/share in system_call_params.exp

parent f20eaf0e
# Copyright (C) 2015 Petr Machata, Red Hat Inc.
# Copyright (C) 1992 - 2001 Free Software Foundation, Inc. # Copyright (C) 1992 - 2001 Free Software Foundation, Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
...@@ -40,6 +41,7 @@ env.exp: Makefile ...@@ -40,6 +41,7 @@ env.exp: Makefile
echo set libelf_LD_LIBRARY_PATH '"$(libelf_LD_LIBRARY_PATH)"' >> [email protected] echo set libelf_LD_LIBRARY_PATH '"$(libelf_LD_LIBRARY_PATH)"' >> [email protected]
echo set elfutils_LD_LIBRARY_PATH '"$(elfutils_LD_LIBRARY_PATH)"' >> [email protected] echo set elfutils_LD_LIBRARY_PATH '"$(elfutils_LD_LIBRARY_PATH)"' >> [email protected]
echo set libunwind_LD_LIBRARY_PATH '"$(libunwind_LD_LIBRARY_PATH)"' >> [email protected] echo set libunwind_LD_LIBRARY_PATH '"$(libunwind_LD_LIBRARY_PATH)"' >> [email protected]
echo set PREFIX '"$(prefix)"' >> [email protected]
CLEANFILES = *.o *.so *.log *.sum *.ltrace site.bak setval.tmp site.exp env.exp CLEANFILES = *.o *.so *.log *.sum *.ltrace site.bak setval.tmp site.exp env.exp
......
...@@ -67,7 +67,8 @@ set conf [ltraceNamedSource "$dir/syscalls.conf" { ...@@ -67,7 +67,8 @@ set conf [ltraceNamedSource "$dir/syscalls.conf" {
# system with the right prefix. So first compile a wrapper that we # system with the right prefix. So first compile a wrapper that we
# use to redirect fopen calls. # 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 "@[email protected]" "$PREFIX"] {
#define _GNU_SOURCE #define _GNU_SOURCE
#include <dlfcn.h> #include <dlfcn.h>
#include <stdio.h> #include <stdio.h>
...@@ -76,13 +77,14 @@ set libfopen_so [ltraceCompile libfopen.so -ldl [ltraceSource c { ...@@ -76,13 +77,14 @@ set libfopen_so [ltraceCompile libfopen.so -ldl [ltraceSource c {
FILE * FILE *
fopen(const char *path, const char *mode) fopen(const char *path, const char *mode)
{ {
if (strncmp(path, "/usr/share", 10) == 0) #define PATH "@[email protected]/share"
path = "/dev/null"; if (strncmp(path, PATH, sizeof(PATH) - 1) == 0)
path = "/dev/null";
return ((FILE *(*)(const char *, const char *)) return ((FILE *(*)(const char *, const char *))
dlsym(RTLD_NEXT, "fopen")) (path, mode); dlsym(RTLD_NEXT, "fopen")) (path, mode);
} }
}]] }]]]
setenv LD_PRELOAD $libfopen_so setenv LD_PRELOAD $libfopen_so
ltraceMatch1 [ltraceRun -L -S -F $conf -- $bin] {^[email protected]\("/some/path"} == 0 ltraceMatch1 [ltraceRun -L -S -F $conf -- $bin] {^[email protected]\("/some/path"} == 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment