Couple more logging questions

Jim Meyering jim at meyering.net
Tue Aug 2 12:05:35 UTC 2011


Pete Zaitcev wrote:
> On Mon, 01 Aug 2011 20:28:11 +0200
> Jim Meyering <jim at meyering.net> wrote:
>
>> > 	log_msg(0,"key-val: %s",safe_for_log(data, len));
>> >
>> > But that has issues with additional memory allocation.
>>
>> I suppose in the unusual case that memory allocation
>> fails, we could resort to replacing each questionable
>> byte with say "?".
>
> Simple substitution may be impossible within the current implementation,
> because we do not have a volatile buffer in which to make it. We supply
> the arguments of log_msg() directly to vsnprintf(), and only manipulate
> the format. I have to think more about that.

When memory allocation fails, we can also fall back on a
fixed-length lock-protected static buffer.


More information about the iwhd-devel mailing list