mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
	John Lenz <lenz@cs.wisc.edu>,
	Richard Purdie <rpurdie@openedhand.com>
Subject: Re: led_class: storing a value can act but return -EINVAL
Date: Sun, 30 Apr 2006 14:10:48 +0200	[thread overview]
Message-ID: <20060430121047.GB30024@elf.ucw.cz> (raw)
In-Reply-To: <1146394862.5019.53.camel@localhost>

Hi!

> > Well, I'd argue current behaviour is okay... can you strace it? It
> > should accept the number (return 3) then return -EINVAL.
> 
> That's exactly what happens.

And that's pretty much exactly okay.

You got success return when you wrote "255" there, then you got
-EINVAL when you tried to put newline there. Expected behaviour, I'd
say.

...I can see it looks ugly when you do echo manually, but you simply
should not do that.

> Which is totally bogus, because userspace will think that the setting
> didn't succeed. Or application authors will ignore the return value
> assuming that it always succeeded. Or read the value back to see if it
> succeeded. All icky, when we can well have a good return value.

Well, they got what they deserve, that \n does not belong there. And
they _did_ get success report -- "3" was returned. That's how unix
works, I'd say. Educate userspace authors that adding \n is bad idea.

							Pavel
-- 
Thanks for all the (sleeping) penguins.

      parent reply	other threads:[~2006-04-30 12:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-29 11:33 Johannes Berg
2006-04-30 10:02 ` Pavel Machek
2006-04-30 11:01   ` Johannes Berg
2006-04-30 11:57     ` Richard Purdie
2006-04-30 12:05       ` Johannes Berg
2006-04-30 12:10     ` Pavel Machek [this message]

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=20060430121047.GB30024@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=johannes@sipsolutions.net \
    --cc=lenz@cs.wisc.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@openedhand.com \
    /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

all inboxes | Powered by JetHome®