public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@csr.com>
To: "Gustavo F. Padovan" <gustavo@las.ic.unicamp.br>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 3/6] Change fprintf(stderr,...) to perror()
Date: Mon, 16 Feb 2009 12:21:27 +0000	[thread overview]
Message-ID: <49995A47.8070401@csr.com> (raw)
In-Reply-To: <1234727246-21064-3-git-send-email-gustavo@las.ic.unicamp.br>

Gustavo F. Padovan wrote:
> 
> @@ -1922,7 +1922,7 @@ static void cmd_lst(int dev_id, int argc, char **argv)
>  	if (dev_id < 0) {
>  		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
>  		if (dev_id < 0) {
> -			fprintf(stderr, "Not connected.\n");
> +			perror("Not connected.");
>  			exit(1);
>  		}
>  	}

You should only perror() if errno is valid for the error being reported.
 Otherwise you're going to get odd messages like:

Not connected.: Success

David
-- 
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park,  Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ                 http://www.csr.com/

  parent reply	other threads:[~2009-02-16 12:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-15 19:47 [PATCH 1/6] Fix more memory leaks in hcitool Gustavo F. Padovan
2009-02-15 19:47 ` [PATCH 2/6] hcitool: fix error message Gustavo F. Padovan
2009-02-15 19:47   ` [PATCH 3/6] Change fprintf(stderr,...) to perror() Gustavo F. Padovan
2009-02-15 19:47     ` [PATCH 4/6] remove verification before free Gustavo F. Padovan
2009-02-15 19:47       ` [PATCH 5/6] Remove unnecessary attribution Gustavo F. Padovan
2009-02-15 19:47         ` [PATCH 6/6] Make expand_name a void function Gustavo F. Padovan
2009-02-16 12:21     ` David Vrabel [this message]
2009-02-16 12:37       ` [PATCH 3/6] Change fprintf(stderr,...) to perror() Gustavo F. Padovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49995A47.8070401@csr.com \
    --to=david.vrabel@csr.com \
    --cc=gustavo@las.ic.unicamp.br \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox