test: Fix sockets03 default SIGPIPE handler not being set to IGN

Submitted by Vitaly Ostrosablin on Dec. 16, 2016, 10:40 a.m.

Details

Message ID 20161216104035.6126-1-vostrosablin@virtuozzo.com
State Superseded
Series "test: Fix sockets03 default SIGPIPE handler not being set to IGN"
Headers show

Commit Message

Vitaly Ostrosablin Dec. 16, 2016, 10:40 a.m.
By default, sockets03 doesn't set SIGPIPE handler to SIG_IGN. When run
by zdtm.py, it doesn't cause problem, because it inherits signal
handler. However, when run via vzt-cpt (which uses system() to launch
tests), it receives default handler (which would terminate test). As
result, test is guaranteed to fail, because it will attempt to write to
shutdown receiver and get SIGPIPE in the face.

PSBM-55941

Signed-off-by: Vitaly Ostrosablin <vostrosablin@virtuozzo.com>
---
 test/zdtm/static/sockets03.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/test/zdtm/static/sockets03.c b/test/zdtm/static/sockets03.c
index 6073dac..6dba45d 100644
--- a/test/zdtm/static/sockets03.c
+++ b/test/zdtm/static/sockets03.c
@@ -35,6 +35,8 @@  int main(int argc, char *argv[])
 	int ret;
 
 	test_init(argc, argv);
+    
+    signal(SIGPIPE, SIG_IGN);
 
 	cwd = get_current_dir_name();
 	if (!cwd) {

Comments

Cyrill Gorcunov Dec. 16, 2016, 11:25 a.m.
On Fri, Dec 16, 2016 at 01:40:35PM +0300, Vitaly Ostrosablin wrote:
> By default, sockets03 doesn't set SIGPIPE handler to SIG_IGN. When run
> by zdtm.py, it doesn't cause problem, because it inherits signal
> handler. However, when run via vzt-cpt (which uses system() to launch
> tests), it receives default handler (which would terminate test). As
> result, test is guaranteed to fail, because it will attempt to write to
> shutdown receiver and get SIGPIPE in the face.
> 
> PSBM-55941
> 
> Signed-off-by: Vitaly Ostrosablin <vostrosablin@virtuozzo.com>

Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Andrey Vagin Dec. 16, 2016, 5:56 p.m.
On Fri, Dec 16, 2016 at 01:40:35PM +0300, Vitaly Ostrosablin wrote:
> By default, sockets03 doesn't set SIGPIPE handler to SIG_IGN. When run
> by zdtm.py, it doesn't cause problem, because it inherits signal
> handler. However, when run via vzt-cpt (which uses system() to launch
> tests), it receives default handler (which would terminate test). As
> result, test is guaranteed to fail, because it will attempt to write to
> shutdown receiver and get SIGPIPE in the face.
> 
> PSBM-55941
> 
> Signed-off-by: Vitaly Ostrosablin <vostrosablin@virtuozzo.com>
> ---
>  test/zdtm/static/sockets03.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/test/zdtm/static/sockets03.c b/test/zdtm/static/sockets03.c
> index 6073dac..6dba45d 100644
> --- a/test/zdtm/static/sockets03.c
> +++ b/test/zdtm/static/sockets03.c
> @@ -35,6 +35,8 @@ int main(int argc, char *argv[])
>  	int ret;
>  
>  	test_init(argc, argv);
> +    
> +    signal(SIGPIPE, SIG_IGN);

I have to use tabs
>  
>  	cwd = get_current_dir_name();
>  	if (!cwd) {
> -- 
> 2.10.2
>