From patchwork Fri Mar 2 15:48:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Hrubis X-Patchwork-Id: 880606 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ztDJN5Zjnz9s5R for ; Sat, 3 Mar 2018 02:49:39 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 35A993E625C for ; Fri, 2 Mar 2018 16:49:33 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) by picard.linux.it (Postfix) with ESMTP id 3DD0D3E625C for ; Fri, 2 Mar 2018 16:49:30 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 636821001887 for ; Fri, 2 Mar 2018 16:49:30 +0100 (CET) Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 08365ACF8 for ; Fri, 2 Mar 2018 15:49:30 +0000 (UTC) From: Cyril Hrubis To: ltp@lists.linux.it Date: Fri, 2 Mar 2018 16:48:38 +0100 Message-Id: <20180302154841.4093-4-chrubis@suse.cz> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180302154841.4093-1-chrubis@suse.cz> References: <20180302154841.4093-1-chrubis@suse.cz> X-Virus-Scanned: clamav-milter 0.99.2 at in-4.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.2 required=7.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, SPF_PASS,T_RP_MATCHES_RCVD autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-4.smtp.seeweb.it Subject: [LTP] [COMMITTED] [PATCH 4/7] syscalls/inotify04: Fix cleanup X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The cleanup attempted to close() the inotify watch descriptors however these are _NOT_ file descriptors and are allocated from completely distinct space. So in this case the inotify watch descriptors we got were 1 and 2 so we closed the stdout and stderr at the end of the test which still made the test pass without any error just by a chance. Signed-off-by: Cyril Hrubis --- testcases/kernel/syscalls/inotify/inotify04.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/testcases/kernel/syscalls/inotify/inotify04.c b/testcases/kernel/syscalls/inotify/inotify04.c index b78277c13..e7f862026 100644 --- a/testcases/kernel/syscalls/inotify/inotify04.c +++ b/testcases/kernel/syscalls/inotify/inotify04.c @@ -81,7 +81,6 @@ static struct tst_kern_exv kvers[] = { static void cleanup(void) { - if (reap_wd_dir && myinotify_rm_watch(fd_notify, wd_dir) == -1) tst_res(TWARN, "inotify_rm_watch(%d, %d) [1] failed", fd_notify, @@ -94,12 +93,6 @@ static void cleanup(void) if (fd_notify > 0 && close(fd_notify)) tst_res(TWARN, "close(%d) [1] failed", fd_notify); - - if (wd_dir > 0 && close(wd_dir)) - tst_res(TWARN, "close(%d) [2] failed", wd_dir); - - if (wd_file > 0 && close(wd_file)) - tst_res(TWARN, "close(%d) [3] failed", wd_file); } static void setup(void)