On Mon, Oct 21, 2013 at 04:22:33PM +0200, Carlos E. R. wrote:
What is exactly a short read? It is an unknown concept to me.
See the read(2) man page: On success, the number of bytes read is returned (zero indicates end of file), and the file position is advanced by this number. It is not an error if this number is smaller than the number of bytes requested; this may happen for example because fewer bytes are actually available right now (maybe because we were close to end-of-file, or because we are reading from a pipe, or from a terminal), or because read() was interrupted by a signal. With /dev/random, the number of bytes available depends on how much entropy has been gathered. You can monitor it via /proc/sys/kernel/random/entropy_avail but even checking in advance doesn't guarantee they will still be available for read() as someone else might read from /dev/random in the meantime. The only reliable way is to repeat the reads until you have the needed amount. If you don't want to wait, you can either use /dev/urandom (if you don't mind worse randomness) or get a hardware generator. Michal Kubeček -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org