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
- Follow-Ups:
- Re: led_class: storing a value can act but return -EINVAL
- From: Pavel Machek <[email protected]>
- Re: led_class: storing a value can act but return -EINVAL
- From: Richard Purdie <[email protected]>
- Re: led_class: storing a value can act but return -EINVAL
- References:
- led_class: storing a value can act but return -EINVAL
- From: Johannes Berg <[email protected]>
- Re: led_class: storing a value can act but return -EINVAL
- From: Pavel Machek <[email protected]>
- led_class: storing a value can act but return -EINVAL
- Prev by Date: Re: Lockless page cache test results
- Next by Date: Re: Lockless page cache test results
- Previous by thread: Re: led_class: storing a value can act but return -EINVAL
- Next by thread: Re: led_class: storing a value can act but return -EINVAL
- Index(es):