Re: led_class: storing a value can act but return -EINVAL

From: Pavel Machek
Date: Sun Apr 30 2006 - 08:11:15 EST


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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/