Meili C
0f17cbfc6a
fix: allow std.linux.getgroups to accept null
...
looking at `man getgroups` and `info getgroups` this is given as an
example:
```c
// Here's how to use ‘getgroups’ to read all the supplementary group
// IDs:
gid_t *
read_all_groups (void)
{
int ngroups = getgroups (0, NULL);
gid_t *groups
= (gid_t *) xmalloc (ngroups * sizeof (gid_t));
int val = getgroups (ngroups, groups);
if (val < 0)
{
free (groups);
return NULL;
}
return groups;
}
```
getgroups(0, NULL) is used to get the count of groups so that the
correct count can be used to allocate a list of gid_t. This small changes makes this
possible.
equivalent example in Zig after the change:
```zig
// get the group count
const ngroups: usize = std.os.linux.getgroups(0, null);
if (ngroups <= 0) {
return error.GetGroupsError;
}
std.debug.print("number of groups: {d}\n", .{ngroups});
const groups_gids: []u32 = try alloc.alloc(u32, ngroups);
// populate an array of gid_t
_ = std.os.linux.getgroups(ngroups, @ptrCast(groups_gids));
```
2024-12-22 21:48:47 +01:00
..
2024-12-18 01:48:54 +05:00
2024-12-16 20:56:29 -05:00
2024-10-13 18:44:42 -07:00
2024-12-14 19:26:55 +00:00
2024-11-29 15:30:05 -05:00
2024-12-16 17:25:52 -05:00
2024-08-28 08:39:59 +01:00
2024-11-27 22:33:29 +01:00
2024-12-15 03:40:20 -08:00
2024-10-12 22:53:02 +02:00
2024-11-07 20:56:33 -05:00
2024-10-13 18:44:42 -07:00
2024-09-12 16:01:23 +01:00
2024-12-18 05:30:08 -05:00
2024-11-24 18:19:11 -05:00
2024-08-28 08:39:59 +01:00
2024-02-23 02:37:11 -07:00
2024-12-22 21:48:47 +01:00
2024-10-04 00:26:55 +02:00
2024-11-27 22:33:29 +01:00
2024-07-23 11:43:12 -07:00
2024-08-27 00:44:35 +01:00
2024-10-04 13:50:25 -07:00
2024-11-28 14:07:28 +01:00
2023-09-06 19:06:32 +03:00
2024-11-27 23:24:37 +01:00
2024-08-15 17:54:27 -07:00
2022-01-01 12:47:08 +00:00
2023-06-24 16:56:39 -07:00
2024-11-04 10:56:32 +01:00
2024-12-18 23:06:35 +00:00
2024-06-13 10:18:59 -04:00
2024-12-11 15:21:56 -05:00
2024-10-31 20:42:53 +00:00
2024-11-29 12:26:23 -08:00
2024-11-13 05:35:05 +01:00
2024-09-04 08:10:12 +00:00
2024-09-19 17:06:23 -07:00
2024-07-09 14:25:42 -07:00
2024-08-23 22:30:10 -07:00
2023-11-19 09:55:07 +00:00
2024-02-26 15:18:31 -08:00
2024-12-18 01:48:54 +05:00
2024-12-11 00:10:15 +01:00
2024-12-14 03:16:34 +01:00
2024-08-23 19:56:24 +02:00
2024-03-10 18:13:30 -07:00
2024-12-11 18:52:43 +01:00
2024-11-29 15:30:05 -05:00
2024-08-22 08:44:08 +02:00
2024-10-12 10:44:17 -07:00
2024-10-12 10:44:17 -07:00
2024-08-29 20:39:11 +01:00
2024-03-21 14:11:46 -07:00
2024-12-13 03:13:14 +01:00
2024-10-17 01:08:58 +02:00
2024-11-01 02:04:27 +03:30
2024-12-15 17:20:08 -08:00
2024-11-24 15:30:52 -08:00
2024-10-04 13:50:25 -07:00
2024-08-07 00:48:32 -07:00
2024-11-25 14:18:55 -08:00
2024-05-03 13:27:30 -07:00
2024-08-28 08:39:59 +01:00
2023-11-24 22:33:50 -07:00
2024-08-28 08:39:59 +01:00
2024-07-31 16:57:42 -07:00
2024-09-02 00:10:22 +03:00
2024-11-22 15:30:07 -08:00
2024-11-24 14:29:44 -08:00
2024-12-05 19:58:38 +00:00
2024-07-19 00:30:32 -07:00
2024-08-27 00:44:35 +01:00
2024-07-19 00:30:32 -07:00
2024-08-29 23:43:52 +01:00
2024-12-11 11:56:44 -08:00
2024-07-23 11:43:12 -07:00
2024-07-09 14:25:42 -07:00
2024-07-20 01:06:28 -07:00
2024-10-23 13:47:44 -07:00
2024-12-13 13:24:38 +01:00
2024-03-10 18:17:23 +11:00
2024-08-28 08:39:59 +01:00
2024-10-31 20:42:53 +00:00
2024-12-13 03:13:14 +01:00
2024-09-23 13:03:06 -07:00
2024-12-11 00:10:17 +01:00
2024-06-20 23:22:39 +00:00
2024-11-07 20:25:26 -05:00
2024-10-04 13:50:25 -07:00
2024-12-15 11:57:19 +01:00
2024-11-12 14:35:14 +02:00
2024-11-02 10:44:18 +01:00
2024-09-26 12:35:14 -07:00
2024-07-28 19:47:55 -07:00
2023-10-31 21:37:35 -04:00
2024-08-21 01:30:46 +01:00
2024-04-12 22:37:07 -07:00
2024-11-04 12:39:48 +01:00
2024-02-26 15:18:31 -08:00
2024-12-16 17:02:35 +00:00
2024-06-17 16:12:19 -04:00