safe_macros: match oldlib SAFE_CLOSE with docs
PATCH 1/1 safe_macros: match oldlib SAFE_CLOSE with docs
Docs say that SAFE_CLOSE() sets the passed file descriptor to -1 after it's successfully closed, but oldlib SAFE_CLOSE doesn't do that.
--- include/old/safe_macros.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
include/old/safe_macros.h +5 -2
@@ -26,8 +26,11 @@#define SAFE_CHDIR (cleanup_fn, path) \ safe_chdir(__FILE__, __LINE__, (cleanup_fn), (path)) -#define SAFE_CLOSE (cleanup_fn, fildes) \ - safe_close(__FILE__, __LINE__, (cleanup_fn), (fildes)) +#define SAFE_CLOSE (cleanup_fn, fd) ({ \ + int ret = safe_close(__FILE__, __LINE__, (cleanup_fn), (fd)); \ + fd = -1; \ + ret; \ + })#define SAFE_CREAT (cleanup_fn, pathname, mode) \ safe_creat(__FILE__, __LINE__, cleanup_fn, (pathname), (mode))
Signature · 1 line
1.8.3.1
PATCH 1/1 safe_macros: match oldlib SAFE_CLOSE with docs
Hi!
Quoted 3 lines
Docs say that
SAFE_CLOSE()sets the passed file descriptor to -1 after it's successfully closed, but oldlibSAFE_CLOSEdoesn't do that.
Have you tried to run at least syscalls testsuite after this change?
I do not expect that this will break anything, but there it's a possibility.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 safe_macros: match oldlib SAFE_CLOSE with docs
----- Original Message -----
Quoted 6 lines
From: "Cyril Hrubis" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected]
Sent: Tuesday, 12 July, 2016 3:55:43 PM
Subject: Re: [LTP] [PATCH]safe_macros: match oldlibSAFE_CLOSEwith docs
Quoted 6 lines
Hi!
Quoted 3 lines
Docs say that
SAFE_CLOSE()sets the passed file descriptor to -1 after it's successfully closed, but oldlibSAFE_CLOSEdoesn't do that.Have you tried to run at least syscalls testsuite after this change?
That was the plan, but I didn't get to that today.
I was thinking syscalls as well, since most common failure seems to be errno tests, trying to trigger EBADF, etc.
I'll reply once I have results.
Regards,
Jan
Quoted 7 lines
I do not expect that this will break anything, but there it's a possibility.
--
Cyril Hrubis
[email protected]
PATCH 1/1 safe_macros: match oldlib SAFE_CLOSE with docs
----- Original Message -----
Quoted 26 lines
From: "Jan Stancek" <[email protected]>
To: "Cyril Hrubis" <[email protected]>
Cc: [email protected]
Sent: Tuesday, 12 July, 2016 6:10:58 PM
Subject: Re: [LTP] [PATCH]safe_macros: match oldlibSAFE_CLOSEwith docs----- Original Message -----
Quoted 6 lines
From: "Cyril Hrubis" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected]
Sent: Tuesday, 12 July, 2016 3:55:43 PM
Subject: Re: [LTP] [PATCH]safe_macros: match oldlibSAFE_CLOSEwith docsQuoted 6 lines
Hi!
Quoted 3 lines
Docs say that
SAFE_CLOSE()sets the passed file descriptor to -1 after it's successfully closed, but oldlibSAFE_CLOSEdoesn't do that.Have you tried to run at least syscalls testsuite after this change?
That was the plan, but I didn't get to that today.
Quoted 11 lines
I was thinking syscalls as well, since most common failure seems to be errno tests, trying to trigger EBADF, etc.
I'll reply once I have results.
Regards,
JanQuoted 3 lines
I do not expect that this will break anything, but there it's a possibility.
I ran syscalls (+small selection of other tests) on x86_64, ppc64le and s390x. Only failure was inotify06, but it turned out, that kernel didn't have a patch for this specific failure [1]. It failed with or without oldlib SAFE_CLOSE patch. inotify06 passed with 4.7.0-rc7+.
Regards,
Jan
[1] https://patchwork.kernel.org/patch/8953231/
Quoted 9 lines
Quoted 5 lines
--
Cyril Hrubis
[email protected]--
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 1/1 safe_macros: match oldlib SAFE_CLOSE with docs
Hi!
Quoted 11 lines
Quoted 11 lines
That was the plan, but I didn't get to that today.
I was thinking syscalls as well, since most common failure seems to be errno tests, trying to trigger EBADF, etc.
I'll reply once I have results.
Regards,
JanQuoted 1 line
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
I do not expect that this will break anything, but there it's a possibility.
I ran syscalls (+small selection of other tests) on
x86_64, ppc64le and s390x. Only failure was inotify06, but it turned out, that kernel didn't have a patch for this specific failure [1]. It failed with or without oldlibSAFE_CLOSEpatch. inotify06 passed with 4.7.0-rc7+.
Thanks for the testing. Patch is acked.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 safe_macros: match oldlib SAFE_CLOSE with docs
----- Original Message -----
Quoted 21 lines
From: "Cyril Hrubis" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: [email protected]
Sent: Wednesday, 13 July, 2016 2:51:17 PM
Subject: Re: [LTP] [PATCH]safe_macros: match oldlibSAFE_CLOSEwith docsHi!
Quoted 14 lines
Quoted 13 lines
That was the plan, but I didn't get to that today.
I was thinking syscalls as well, since most common failure seems to be errno tests, trying to trigger EBADF, etc.
I'll reply once I have results.
Regards,
JanQuoted 3 lines
I do not expect that this will break anything, but there it's a possibility.
Quoted 6 lines
Quoted 4 lines
I ran syscalls (+small selection of other tests) on
x86_64, ppc64le and s390x. Only failure was inotify06, but it turned out, that kernel didn't have a patch for this specific failure [1]. It failed with or without oldlibSAFE_CLOSEpatch. inotify06 passed with 4.7.0-rc7+.Thanks for the testing. Patch is acked.
Pushed.
Regards,
Jan
Quoted 5 lines
--
Cyril Hrubis
[email protected]