diff mbox series

[1/3] tst-realloc: do not check for errno on success [BZ #22611]

Message ID 20171221225453.13158-2-aurelien@aurel32.net
State New
Headers show
Series Fix wrong assumption about errno | expand

Commit Message

Aurelien Jarno Dec. 21, 2017, 10:54 p.m. UTC
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

Carlos O'Donell Dec. 22, 2017, 3:07 a.m. UTC | #1
On 12/21/2017 02:54 PM, 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.
> 
> Changelog:
> 	[BZ #22611]
> 	* malloc/tst-realloc.c (do_test): Remove the test checking that errno
> 	is unchanged on success.

OK.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  ChangeLog            | 6 ++++++
>  malloc/tst-realloc.c | 4 ----
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 55295b1368..cb41a07a25 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,9 @@
> +2017-12-21  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-21  Szabolcs Nagy  <szabolcs.nagy@arm.com>
>  
>  	* scripts/build-many-glibcs.py (Context.add_all_configs): Add
> diff --git a/malloc/tst-realloc.c b/malloc/tst-realloc.c
> index 31a58bd026..d942c6e536 100644
> --- a/malloc/tst-realloc.c
> +++ b/malloc/tst-realloc.c
> @@ -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);
>
diff mbox series

Patch

diff --git a/ChangeLog b/ChangeLog
index 55295b1368..cb41a07a25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@ 
+2017-12-21  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-21  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
 	* scripts/build-many-glibcs.py (Context.add_all_configs): Add
diff --git a/malloc/tst-realloc.c b/malloc/tst-realloc.c
index 31a58bd026..d942c6e536 100644
--- a/malloc/tst-realloc.c
+++ b/malloc/tst-realloc.c
@@ -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);