summaryrefslogtreecommitdiff
path: root/tests/cp/nfs-removal-race.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cp/nfs-removal-race.sh')
-rwxr-xr-xtests/cp/nfs-removal-race.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/cp/nfs-removal-race.sh b/tests/cp/nfs-removal-race.sh
index 6969e8bd..fdac03f7 100755
--- a/tests/cp/nfs-removal-race.sh
+++ b/tests/cp/nfs-removal-race.sh
@@ -13,7 +13,7 @@
# This test is skipped on systems that lack LD_PRELOAD support; that's fine.
# Similarly, on a system that lacks <dlfcn.h> or __xstat, skipping it is fine.
-# Copyright (C) 2012-2014 Free Software Foundation, Inc.
+# Copyright (C) 2012-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -35,6 +35,7 @@ require_gcc_shared_
# Replace each stat call with a call to this wrapper.
cat > k.c <<'EOF' || framework_failure_
#define _GNU_SOURCE
+#include <stdio.h>
#include <sys/types.h>
#include <dlfcn.h>
@@ -49,6 +50,7 @@ int
__xstat (int ver, const char *path, struct stat *st)
{
static int (*real_stat)(int ver, const char *path, struct stat *st) = NULL;
+ fclose(fopen("preloaded", "w"));
if (!real_stat)
real_stat = dlsym (RTLD_NEXT, "__xstat");
/* When asked to stat nonexistent "d",
@@ -65,7 +67,9 @@ touch d2 || framework_failure_
echo xyz > src || framework_failure_
# Finally, run the test:
-LD_PRELOAD=./k.so cp src d || fail=1
+LD_PRELOAD=$LD_PRELOAD:./k.so cp src d || fail=1
+
+test -f preloaded || skip_ 'LD_PRELOAD was ineffective?'
compare src d || fail=1
Exit $fail