Avoid use of strlen in getlogin_r (bug 22447).