From patchwork Mon Mar 14 15:53:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 8581141 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3D8FB9F6E1 for ; Mon, 14 Mar 2016 15:53:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78F2F203A5 for ; Mon, 14 Mar 2016 15:53:56 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5FE0E20395 for ; Mon, 14 Mar 2016 15:53:55 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F37131A1F30; Mon, 14 Mar 2016 08:54:12 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D621C1A1F30 for ; Mon, 14 Mar 2016 08:54:11 -0700 (PDT) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1F41DABB4; Mon, 14 Mar 2016 15:53:51 +0000 (UTC) From: Johannes Thumshirn To: Dan Williams Subject: [ndctl PATCH] ndctl: Bail out with unkown command in case of an unknown command Date: Mon, 14 Mar 2016 16:53:36 +0100 Message-Id: <1457970816-5625-1-git-send-email-jthumshirn@suse.de> X-Mailer: git-send-email 2.7.2 Cc: linux-nvdimm@lists.01.org X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP handle_internal_command() only returns to main if it doesn't find the specified command and does not set an errno. When running an unknown command you get the following error message: $ ./ndctl asd Failed to run command 'asd': Success Instead of a more appropriate: $ ./ndctl asd Unknown command: 'asd' Signed-off-by: Johannes Thumshirn --- ndctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ndctl.c b/ndctl.c index ded1588..18b5dc6 100644 --- a/ndctl.c +++ b/ndctl.c @@ -159,8 +159,7 @@ int main(int argc, const char **argv) goto out; } handle_internal_command(argc, argv); - fprintf(stderr, "Failed to run command '%s': %s\n", - argv[0], strerror(errno)); + fprintf(stderr, "Unknown command: '%s'\n", argv[0]); out: return 1; }