lkml.org 
[lkml]   [2006]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: led_class: storing a value can act but return -EINVAL
From
Date
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.

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.

> > There are two possible ways to handle this:
> > a) accept anything that begins with a valid number.
> > b) reject anything that isn't *only* a number
>
> c) accept anything that is number, ignore newlines.

Which is kinda hard to implement.

> a) is just way too ugly...

Well, I'd argue that it doesn't matter much since sysfs values are by
definition a single value per file, so you'll already know that putting
multiple "values" in is bogus.

johannes
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2006-04-30 13:25    [W:0.959 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site