3 (Linux Access Control List Management)
5 Copyright (C) 1999, 2000
6 Andreas Gruenbacher, <a.gruenbacher@bestbits.at>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26 #include "user_group.h"
30 user_name(uid_t uid, int numeric)
32 struct passwd *passwd = numeric ? NULL : getpwuid(uid);
33 static char uid_str[22];
37 return passwd->pw_name;
38 ret = snprintf(uid_str, sizeof(uid_str), "%ld", (long)uid);
39 if (ret < 1 || (size_t)ret >= sizeof(uid_str))
46 group_name(gid_t gid, int numeric)
48 struct group *group = numeric ? NULL : getgrgid(gid);
49 static char gid_str[22];
53 return group->gr_name;
54 ret = snprintf(gid_str, sizeof(gid_str), "%ld", (long)gid);
55 if (ret < 1 || (size_t)ret >= sizeof(gid_str))