* Avoid fall-through in test-container if execlp fails
@ 2019-02-12 23:05 Joseph Myers
2019-02-13 8:19 ` Florian Weimer
2019-02-13 17:01 ` DJ Delorie
0 siblings, 2 replies; 3+ messages in thread
From: Joseph Myers @ 2019-02-12 23:05 UTC (permalink / raw
To: libc-alpha
One of the implicit-fallthrough warnings from compiling glibc with
-Wextra appears to indicate an actual bug: the test-container code
could fall through inappropriately if execlp returns (which only
occurs on error). This patch adds appropriate error handling in this
case to avoid that fall-through.
Tested for x86_64.
2019-02-12 Joseph Myers <joseph@codesourcery.com>
* support/test-container.c (recursive_remove): Use FAIL_EXIT1 if
execlp returns.
diff --git a/support/test-container.c b/support/test-container.c
index a24b24c03b..ed911e33f9 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -361,6 +361,7 @@ recursive_remove (char *path)
case 0:
/* Child. */
execlp ("rm", "rm", "-rf", path, NULL);
+ FAIL_EXIT1 ("exec rm: %m");
default:
/* Parent. */
waitpid (child, &status, 0);
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Avoid fall-through in test-container if execlp fails
2019-02-12 23:05 Avoid fall-through in test-container if execlp fails Joseph Myers
@ 2019-02-13 8:19 ` Florian Weimer
2019-02-13 17:01 ` DJ Delorie
1 sibling, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2019-02-13 8:19 UTC (permalink / raw
To: Joseph Myers; +Cc: libc-alpha
* Joseph Myers:
> diff --git a/support/test-container.c b/support/test-container.c
> index a24b24c03b..ed911e33f9 100644
> --- a/support/test-container.c
> +++ b/support/test-container.c
> @@ -361,6 +361,7 @@ recursive_remove (char *path)
> case 0:
> /* Child. */
> execlp ("rm", "rm", "-rf", path, NULL);
> + FAIL_EXIT1 ("exec rm: %m");
> default:
> /* Parent. */
> waitpid (child, &status, 0);
Looks good to me.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Avoid fall-through in test-container if execlp fails
2019-02-12 23:05 Avoid fall-through in test-container if execlp fails Joseph Myers
2019-02-13 8:19 ` Florian Weimer
@ 2019-02-13 17:01 ` DJ Delorie
1 sibling, 0 replies; 3+ messages in thread
From: DJ Delorie @ 2019-02-13 17:01 UTC (permalink / raw
To: Joseph Myers; +Cc: libc-alpha
Joseph Myers <joseph@codesourcery.com> writes:
> * support/test-container.c (recursive_remove): Use FAIL_EXIT1 if
> execlp returns.
LGTMtoo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-13 16:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-12 23:05 Avoid fall-through in test-container if execlp fails Joseph Myers
2019-02-13 8:19 ` Florian Weimer
2019-02-13 17:01 ` DJ Delorie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).