MCPcopy Create free account
hub / github.com/RsyncProject/rsync / group_to_gid

Function group_to_gid

uidlist.c:170–193  ·  view source on GitHub ↗

Parse a group name or (optionally) a number into a gid */

Source from the content-addressed store, hash-verified

168
169/* Parse a group name or (optionally) a number into a gid */
170int group_to_gid(const char *name, gid_t *gid_p, BOOL num_ok)
171{
172 if (!name || !*name)
173 return 0;
174
175 if (num_ok && name[strspn(name, "0123456789")] == '\0') {
176 *gid_p = id_parse(name);
177 return 1;
178 }
179
180 if (namecvt_pid) {
181 id_t id;
182 if (!namecvt_call("grp", &name, &id))
183 return 0;
184 *gid_p = id;
185 } else {
186 struct group *grp = getgrnam(name);
187 if (!grp)
188 return 0;
189 *gid_p = grp->gr_gid;
190 }
191
192 return 1;
193}
194
195static int is_in_group(gid_t gid)
196{

Callers 5

recv_add_idFunction · 0.85
parse_name_mapFunction · 0.85
become_copy_as_userFunction · 0.85
add_a_groupFunction · 0.85
start_daemonFunction · 0.85

Calls 2

id_parseFunction · 0.85
namecvt_callFunction · 0.85

Tested by

no test coverage detected