getlogin_r: Work around bug in Mac OS X 10.12. * m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Test also against the Mac OS X bug. * lib/getlogin_r.c (getlogin_r): When getlogin_r returns a string of the given size minus 1, call getlogin_r a second time, on a larger buffer. * modules/getlogin_r (Depends-on): Add malloca. * doc/posix-functions/getlogin_r.texi: Mention the Mac OS X bug.