[v2,1/3] tst-realloc: do not check for errno on success [BZ #22611]
Commit Message
POSIX explicitly says that applications should check errno only after
failure, so the errno value can be clobbered on success as long as it
is not set to zero.
Changelog:
[BZ #22611]
* malloc/tst-realloc.c (do_test): Remove the test checking that errno
is unchanged on success.
---
ChangeLog | 6 ++++++
malloc/tst-realloc.c | 4 ----
2 files changed, 6 insertions(+), 4 deletions(-)
Comments
On Fri, Dec 22, 2017 at 08:30:59PM +0100, Aurelien Jarno wrote:
> POSIX explicitly says that applications should check errno only after
> failure, so the errno value can be clobbered on success as long as it
> is not set to zero.
The trailing part "as long as it is not set to zero." sounds confusing
in this context, I think "the errno value can be clobbered on success."
is good enough by itself.
The patch is fine, please commit.
@@ -1,3 +1,9 @@
+2017-12-22 Aurelien Jarno <aurelien@aurel32.net>
+
+ [BZ #22611]
+ * malloc/tst-realloc.c (do_test): Remove the test checking that errno
+ is unchanged on success.
+
2017-12-22 Eric Blake <ebb9@byu.net>
Avoid gcc warnings on cygwin
@@ -66,10 +66,6 @@ do_test (void)
if (p == NULL)
merror ("realloc (NULL, 10) failed.");
- /* errno should be clear on success (POSIX). */
- if (p != NULL && save != 0)
- merror ("errno is set but should not be");
-
free (p);
p = calloc (20, 1);