diff options
author | Pádraig Brady <P@draigBrady.com> | 2016-11-24 01:26:30 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2016-11-24 01:31:45 +0000 |
commit | 4258e97b2d8e84df6347d9095c4f82f6649b1d9e (patch) | |
tree | b700fb9637b797ff2be1b68107384b576f0e24ac /tests/rm | |
parent | 4954f79ad2e38e4198af301bf52c3562af39d482 (diff) | |
download | coreutils-4258e97b2d8e84df6347d9095c4f82f6649b1d9e.tar.xz |
tests: fix false failure with ASAN in rm-readdir-fail
* tests/rm/rm-readdir-fail.sh: ASAN correctly indicated
that fts was writing to freed memory. This was because
we reused a single dirent in our readdir() test wrapper.
Since fts was deallocating those dirents, we now get
a new dirent for each call to our readdir wrapper.
Diffstat (limited to 'tests/rm')
-rwxr-xr-x | tests/rm/rm-readdir-fail.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/rm/rm-readdir-fail.sh b/tests/rm/rm-readdir-fail.sh index 835d3424f..91fb0f649 100755 --- a/tests/rm/rm-readdir-fail.sh +++ b/tests/rm/rm-readdir-fail.sh @@ -47,8 +47,8 @@ struct dirent *readdir (DIR *dirp) errno = ESRCH; return NULL; } - static struct dirent* d; - if (! d && ! ( d = real_readdir (dirp))) + struct dirent* d; + if (! (d = real_readdir (dirp))) { fprintf (stderr, "Failed to get dirent\n"); errno = ENOENT; @@ -90,8 +90,10 @@ for READDIR_PARTIAL in '' '1'; do rm -f preloaded (export LD_PRELOAD=$LD_PRELOAD:./k.so returns_ 1 rm -Rf dir 2>>err) || fail=1 - test -f preloaded || + if ! test -f preloaded; then + cat err skip_ "internal test failure: maybe LD_PRELOAD doesn't work?" + fi done # First case is failure to read any items from dir, then assume empty. |