From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24326 invoked by alias); 11 Aug 2004 21:19:48 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 24308 invoked from network); 11 Aug 2004 21:19:48 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.15.26) by sourceware.org with SMTP; 11 Aug 2004 21:19:48 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i7BJ2d3j025582; Wed, 11 Aug 2004 21:02:39 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i7BJ2c2u025580; Wed, 11 Aug 2004 21:02:38 +0200 Date: Wed, 11 Aug 2004 21:19:00 -0000 From: Jakub Jelinek To: Ulrich Drepper , Roland McGrath Cc: Glibc hackers Subject: [PATCH] Fix tst-timer{2,4} Message-ID: <20040811190238.GX30497@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2004-08/txt/msg00039.txt.bz2 Hi! These two testcases segfault if timer_create fails, which is IMHO not a good thing. Using a timer_t after timer_create failed is also a bad example, so we should avoid that. 2004-08-11 Jakub Jelinek * rt/tst-timer2.c (do_test): If timer_create fails, just continue. * rt/tst-timer4.c (do_test): If one of the timer_create calls fails, return 1 immediately. --- libc/rt/tst-timer2.c.jj 2004-04-13 10:42:54.000000000 +0200 +++ libc/rt/tst-timer2.c 2004-08-11 23:02:39.938193370 +0200 @@ -40,7 +40,10 @@ do_test (void) printf ("cnt = %d\n", i); if (timer_create (CLOCK_REALTIME, &sigev, &timerId) < 0) - perror ("timer_create"); + { + perror ("timer_create"); + continue; + } res = timer_settime (timerId, 0, &itval, NULL); if (res < 0) --- libc/rt/tst-timer4.c.jj 2004-04-21 10:06:06.000000000 +0200 +++ libc/rt/tst-timer4.c 2004-08-11 23:08:57.886378961 +0200 @@ -206,7 +206,7 @@ do_test (void) if (timer_create (CLOCK_REALTIME, &ev, &timer_none) != 0) { printf ("*** timer_create for timer_none failed: %m\n"); - result = 1; + return 1; } struct sigaction sa = { .sa_sigaction = sig1_handler, @@ -223,7 +223,7 @@ do_test (void) if (timer_create (CLOCK_REALTIME, &ev, &timer_sig1) != 0) { printf ("*** timer_create for timer_sig1 failed: %m\n"); - result = 1; + return 1; } memset (&ev, 0x33, sizeof (ev)); @@ -233,7 +233,7 @@ do_test (void) if (timer_create (CLOCK_REALTIME, &ev, &timer_sig2) != 0) { printf ("*** timer_create for timer_sig2 failed: %m\n"); - result = 1; + return 1; } memset (&ev, 0x44, sizeof (ev)); @@ -244,7 +244,7 @@ do_test (void) if (timer_create (CLOCK_REALTIME, &ev, &timer_thr1) != 0) { printf ("*** timer_create for timer_thr1 failed: %m\n"); - result = 1; + return 1; } pthread_attr_t nattr; @@ -263,7 +263,7 @@ do_test (void) if (timer_create (CLOCK_REALTIME, &ev, &timer_thr2) != 0) { printf ("*** timer_create for timer_thr2 failed: %m\n"); - result = 1; + return 1; } int ret = timer_getoverrun (timer_thr1); Jakub