~elementary-apps/pantheon-files/trunk

« back to all changes in this revision

Viewing changes to libcore/eel-fcts.c

Merge trunk to r2319

Show diffs side-by-side

added added

removed removed

Lines of Context:
175
175
}
176
176
 
177
177
gboolean
 
178
eel_user_in_group (const char *group_name)
 
179
{
 
180
    GList *list;
 
181
    struct group *group;
 
182
    int count, i;
 
183
    gid_t gid_list[NGROUPS_MAX + 1];
 
184
    gboolean found;
 
185
 
 
186
    list = NULL;
 
187
    found = FALSE;
 
188
 
 
189
    count = getgroups (NGROUPS_MAX + 1, gid_list);
 
190
    for (i = 0; i < count; i++) {
 
191
        group = getgrgid (gid_list[i]);
 
192
        if (group == NULL)
 
193
            break;
 
194
 
 
195
        if (g_strcmp0 (group_name, group->gr_name) == 0) {
 
196
            found = TRUE;
 
197
            break;
 
198
        }
 
199
    }
 
200
 
 
201
    return found;
 
202
}
 
203
 
 
204
gboolean
178
205
eel_get_group_id_from_group_name (const char *group_name, uid_t *gid)
179
206
{
180
207
    struct group *group;