Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5993329ybc; Wed, 27 Nov 2019 13:04:14 -0800 (PST) X-Google-Smtp-Source: APXvYqweJ99O4YM2cNesx9YSzX5keSJgXLP+w/ot0686fPCshNlg6Eg+hkzOLQz/MhSfxDEsClkx X-Received: by 2002:a50:e88a:: with SMTP id f10mr29165793edn.277.1574888654054; Wed, 27 Nov 2019 13:04:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888654; cv=none; d=google.com; s=arc-20160816; b=WpPiUUFTVideSmFO/8CMW5eGbBzE/NKMzpqtQlEW2xow4wL99JhgVG2OYG5AjCGGfw /0x7x3/z4RqP0nnAHqHecxmHayX2Y8NXC78Du84W8Yed/xdpzSlX2Wmh0+F1KDRck2f7 vYjHQAJJVE2v6XpEA/dbIcd+hgnGxxeseCfBn8i7ItfPkCADf4LMLSGOqmvlVRPHzSzy /V4hHHgMCZoqoGrrbucfdCNL5w9UKlOEb5MsuKakNQWW+xMa0rCesv+XYM0zIpCSaG6I capdRxUAKfF5swN/PwaBHy4VxLtRdqUQPWMSr7Q00A0TAuMyE8FNs7/4BZS0AJrs8R1A Kxcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5io8IIq4Y4z7GtWNK/1b0PKOiCo/IIEEUPJ1QThLaWM=; b=z3X2hsAnmXxZxAlydwQH+pjrhpShsS0UhKHK3/jeThhdY+vnGUhy/cCGZ1tEfIuvSK owgUd7iG2uJ76s1sA/0UP6tdFUgqJ4t/3P5fKzEIywy79p4JgcsfOLmgoTzNs+U+oyaH TCf+9u7hnSu1YWOt2wJuYb3i5XQberLIouZzO/sMjiWc+Lw/7qQ7RphjSpBVL3DzGW/I Y1xWrnrFf+RmWhW4dvMJoY89S00tp7awcFx9SRh5CpIdt/6FfdpiMAo2hHhVpfFtgCCl m3+7sZlK0MMlexiQ+GzSG31GuvDgfazeNAMJCRhrEqsmLGuGqG3vDlLncr9yom0M7/1W iuUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iJrFp8z7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12si1382224edr.222.2019.11.27.13.03.40; Wed, 27 Nov 2019 13:04:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iJrFp8z7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731601AbfK0VAq (ORCPT + 99 others); Wed, 27 Nov 2019 16:00:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:52718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731073AbfK0VAo (ORCPT ); Wed, 27 Nov 2019 16:00:44 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 408092158C; Wed, 27 Nov 2019 21:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888443; bh=lVm6YqHpo7guvAgq3Pxt5xirqFmtv4mPKPJex/8STw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJrFp8z7zb/nUYWqFcqTexJt32gRexzMi5KRZLRKBqLVc1hf4BKtmPnp9nBjpFn9/ 5o1eLXzRrhC0kkEBoOGJjfmTu2p83kM7tIgMO/nB2Fi4BPyXBjADabNOnyTK5d1TEG hS5oz6gIawT5m16D09KKSb12I8MI2t3WohmoTWtU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Shuah Khan (Samsung OSG)" , Sasha Levin Subject: [PATCH 4.19 135/306] selftests: watchdog: fix message when /dev/watchdog open fails Date: Wed, 27 Nov 2019 21:29:45 +0100 Message-Id: <20191127203124.920633069@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shuah Khan (Samsung OSG) [ Upstream commit 9a244229a4b850b11952a0df79607c69b18fd8df ] When /dev/watchdog open fails, watchdog exits with "watchdog not enabled" message. This is incorrect when open fails due to insufficient privilege. Fix message to clearly state the reason when open fails with EACCESS when a non-root user runs it. Signed-off-by: Shuah Khan (Samsung OSG) Signed-off-by: Sasha Levin --- tools/testing/selftests/watchdog/watchdog-test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c index 6e290874b70e2..e029e2017280f 100644 --- a/tools/testing/selftests/watchdog/watchdog-test.c +++ b/tools/testing/selftests/watchdog/watchdog-test.c @@ -89,7 +89,13 @@ int main(int argc, char *argv[]) fd = open("/dev/watchdog", O_WRONLY); if (fd == -1) { - printf("Watchdog device not enabled.\n"); + if (errno == ENOENT) + printf("Watchdog device not enabled.\n"); + else if (errno == EACCES) + printf("Run watchdog as root.\n"); + else + printf("Watchdog device open failed %s\n", + strerror(errno)); exit(-1); } -- 2.20.1