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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux