syscalls/dup203: Fix make use of SAFE_CLOSE()
PATCH 1/1 syscalls/dup203: Fix make use of SAFE_CLOSE()
The patch:
commit df007542635aed8686b5ebc111b0807a67349b41
Author: Cyril Hrubis <[email protected]> Date: Tue Oct 3 13:29:15 2017 +0200
Make use of SAFE_CLOSE()
Broke the test since it opens and closes a fd in order to get free file descriptor to pass to dup2() as newfd. The problem here is that SAFE_CLOSE() sets the file descriptor to -1, which is usually good thing.
This patch fixes the problem by using temporary variable to store the fd to pass it to SAFE_CLOSE().
Fixes #219
Signed-off-by Cyril Hrubis <[email protected]>
--- testcases/kernel/syscalls/dup2/dup203.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/dup2/dup203.c +3 -1
@@ -144,7 +144,9 @@ int main(int ac, char **av)tst_brkm (TBROK , cleanup,"Cannot create second file" ); } -SAFE_CLOSE (cleanup, fd2); +/* SAFE_CLOSE() sets the fd to -1 avoid it here */ + rval = fd2; +SAFE_CLOSE (cleanup, rval);TEST (dup2 (fd0, fd2));
Signature · 1 line
2.13.5