5 * Sebastien Pouliot <sebastien@ximian.com>
7 * (C) 2004 Novell (http://www.novell.com)
11 #include <mono/io-layer/io-layer.h>
15 #include <sys/types.h>
20 GetUserName (gchar *buffer, gint32 *size)
22 #ifdef HAVE_GETPWUID_R
31 SetLastError (ERROR_INVALID_PARAMETER);
36 #ifdef HAVE_GETPWUID_R
37 fbufsize = (size_t) sysconf (_SC_GETPW_R_SIZE_MAX);
38 fbuf = g_malloc0 (fbufsize);
39 pbuf = g_new0 (struct passwd, 1);
40 getpwuid_r (uid, pbuf, fbuf, fbufsize, &p);
45 gint32 sz = strlen (p->pw_name);
49 strncpy (buffer, p->pw_name, sz);
55 #ifdef HAVE_GETPWUID_R
60 SetLastError (ERROR_INVALID_HANDLE);