From patchwork Fri Aug 10 02:56:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhanghui Yuan X-Patchwork-Id: 956021 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=fail (p=none dis=none) header.from=intel.com 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 41mxYW3NGRz9s4Z for ; Fri, 10 Aug 2018 17:28:15 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id DCD913E7121 for ; Fri, 10 Aug 2018 09:28:11 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) by picard.linux.it (Postfix) with ESMTP id DE9543E60E4 for ; Fri, 10 Aug 2018 05:00:44 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 67FFB6018B4 for ; Fri, 10 Aug 2018 05:00:43 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2018 20:00:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,217,1531810800"; d="scan'208";a="61323259" Received: from yzh-dev.bj.intel.com ([10.238.154.64]) by fmsmga007.fm.intel.com with ESMTP; 09 Aug 2018 20:00:41 -0700 From: Zhanghui Yuan To: ltp@lists.linux.it Date: Fri, 10 Aug 2018 10:56:56 +0800 Message-Id: <20180810025656.8825-1-zhanghuix.yuan@intel.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it X-Mailman-Approved-At: Fri, 10 Aug 2018 09:28:10 +0200 Cc: Zhanghui Yuan Subject: [LTP] [PATCH ltp] syscalls/bind02.c: Fix create socker failed for nobody user and nogroup for "Permission denied" 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" Socket will try to be bind by user: nobody, group: nobody and socket failed for "Permission denied" Add line 89~95 to fix this issue: if (errno == EACCES) { tst_resm(TPASS, "correct error"); return; } else { tst_brkm(TBROK | TERRNO, 0, "socket() failed"); } Signed-off-by: Zhanghui Yuan --- testcases/kernel/syscalls/bind/bind02.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/testcases/kernel/syscalls/bind/bind02.c b/testcases/kernel/syscalls/bind/bind02.c index 90b0e9d8e..84ce588ce 100644 --- a/testcases/kernel/syscalls/bind/bind02.c +++ b/testcases/kernel/syscalls/bind/bind02.c @@ -86,7 +86,12 @@ void try_bind(void) } if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - tst_brkm(TBROK | TERRNO, 0, "socket() failed"); + if (errno == EACCES) { + tst_resm(TPASS, "correct error"); + return; + }else { + tst_brkm(TBROK | TERRNO, 0, "socket() failed"); + } } memset(&servaddr, 0, sizeof(servaddr));