On Tue, 7 Mar 2006, Chuck Ebbert wrote:
>  The snprintf() and print_modalias() calls don't check for errors and
> thus don't return -ENOMEM when the buffer does fill up. Shouldn't they
> do that instead of returning a truncated env string?
They try to act like the standard says "snprintf()" should act.
And yes, the standard says to return the number of bytes you _would_ have
written, had not the buffer been to small.
(Of course, giving a negative buffer length is not ok, and the kernel
version checking for that is a kernel extension on the standard. In the
standard, the buffer size is a "size_t", which doesn't have the notion of
"negative", since it's an unsigned type. The kernel version is just being
safe and nice).
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Video 4 Linux]
[Linux for the blind]