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.
#
# 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)"' >> [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 PREFIX '"$(prefix)"' >> [email protected]
CLEANFILES = *.o *.so *.log *.sum *.ltrace site.bak setval.tmp site.exp env.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 "@[email protected]" "$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)
#define PATH "@[email protected]/share"
if (strncmp(path, PATH, sizeof(PATH) - 1) == 0)
path = "/dev/null";
return ((FILE *(*)(const char *, const char *))
dlsym(RTLD_NEXT, "fopen")) (path, mode);
}
}]]
}]]]
setenv LD_PRELOAD $libfopen_so
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