read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-01 Thread Steve Schnepp
+v2.6.32/kernel/sysctl.c#L2371 -- Steve Schnepp http://blog.pwkf.org/ -- To unsubscribe from this list: send the line unsubscribe dash in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-02 Thread Steve Schnepp
2010/9/1 Steve Schnepp steve.schn...@gmail.com: conforming to POSIX isn't a realistic option, would it be possible to have a workaround that doesn't involve an external tool like cat(1) ? Hi, I just hacked attached a little patch away to be able to solve this case. Feel free to reply with your

Re: read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-03 Thread Steve Schnepp
offset 0 should fail like reading one byte from offset 1 does). +1 for the proper way to read these files needs to be documented and I also think that emitting an error would be better than silently returning erroneous data. [ EOVERFLOW is coming to my mind ] -- Steve Schnepp http://blog.pwkf.org

Re: read() builtin doesn't read integer value /proc files (but bash's does)

2010-09-04 Thread Steve Schnepp
understanding. -- Steve Schnepp http://blog.pwkf.org/ A possible fix is to check first if the input supports seeking. If it does, use the buffering and at the end of the line seek backwards for the number of bytes remaining in the buffer. If it does not, read one byte at a time. -- Jilles