if (name == NULL) return EFAULT;
getlogin_r(char *name, size_t namelen){	int logname_size;	if (name == NULL)		return EFAULT;	_THREAD_PRIVATE_MUTEX_LOCK(logname);	if (!logname_valid) {		if (_getlogin(logname, sizeof(logname) - 1) < 0) {			_THREAD_PRIVATE_MUTEX_UNLOCK(logname);			return errno;		}		logname_valid = 1;		logname[MAXLOGNAME] = '\0';	/* paranoia */	}	logname_size = strlen(logname) + 1;	if (namelen < logname_size) {		_THREAD_PRIVATE_MUTEX_UNLOCK(logname);		return ERANGE;	}	memcpy(name, logname, logname_size);	_THREAD_PRIVATE_MUTEX_UNLOCK(logname);	return 0;}