From: Calvin Walton <calvin.walton@gmail.com>
To: Peter Klotz <peter.klotz@aon.at>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Misleading error message in btrfsctl
Date: Sun, 18 Jan 2009 09:12:30 -0500 [thread overview]
Message-ID: <1232287950.10058.6.camel@trillian> (raw)
In-Reply-To: <49733138.4010309@aon.at>
On Sun, 2009-01-18 at 14:40 +0100, Peter Klotz wrote:
> Calling btrfsctl results in this message when module btrfs.ko is not loaded:
>
> root@asus:/root# btrfsctl -A /dev/sda
> ioctl:: Bad file descriptor
..
> The output with applied patch:
>
> root@asus:/root# btrfsctl -A /dev/sda
> failed to open /dev/btrfs-control
It would probably be better to use perror() instead of fprintf, in order
to give the actual error message. I often find it useful to know why the
device failed to open - is it missing, permission issues? I've updated
the patch:
diff --git a/btrfsctl.c b/btrfsctl.c
index e049799..df1a165 100644
--- a/btrfsctl.c
+++ b/btrfsctl.c
@@ -189,6 +189,10 @@ int main(int ac, char **av)
if (command == BTRFS_IOC_SCAN_DEV) {
fd = open("/dev/btrfs-control", O_RDWR);
+ if (fd < 0) {
+ perror("failed to open /dev/btrfs-control");
+ exit(1);
+ }
name = fname;
} else {
fd = open_file_or_dir(fname);
--
Calvin Walton <calvin.walton@gmail.com>
next prev parent reply other threads:[~2009-01-18 14:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-18 13:40 Misleading error message in btrfsctl Peter Klotz
2009-01-18 14:12 ` Calvin Walton [this message]
2009-01-21 15:05 ` Chris Mason
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=1232287950.10058.6.camel@trillian \
--to=calvin.walton@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=peter.klotz@aon.at \
/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