[PATCH,HURD] hurd: compliance fixes for getlogin_r
Roland McGrath
roland@hack.frob.com
Fri Apr 27 22:15:00 GMT 2012
You can just use string_t and no need for the XXX comment.
libc code can use C99 freely these days, so use an inline initializing
declaration rather than pre-declaring a new variable.
I don't think there's any need to iniitalize the result buffer. We trust
the RPC stubs to return a properly-terminated string on success, and if
they didn't then that wouldn't necessarily catch it anyway. If you want
that sort of paranoia, use __strnlen (login, sizeof login - 1).
If you've already called strlen/strnlen then don't use strncpy,
just use memcpy with the known length.
Thanks,
Roland
More information about the Libc-alpha
mailing list