blob: 9b3b5af9875215a416fb752aa0a5a073004d01fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include <limits.h> // for LINE_MAX
#include <pwd.h> // for getpwuid_r, getpwuid, passwd
#include <stddef.h> // for NULL
#include <sys/types.h> // for uid_t
struct passwd *getpwuid(uid_t uid)
{
static struct passwd pwd;
static char buf[LINE_MAX * 4];
struct passwd *res;
if (getpwuid_r(uid, &pwd, buf, sizeof(buf), &res) != 0)
return NULL;
return res;
}
|