diff options
author | 2021-10-16 02:41:38 -0300 | |
---|---|---|
committer | 2021-10-16 17:08:29 -0300 | |
commit | f3001185bb91c4595ef1bde15e537c016edbd2a1 (patch) | |
tree | bb2b0985fa1fd58ecc3682214feb80f63eb5ceff | |
parent | util.c: remove tty comment from get_group_id (diff) | |
download | firejail-f3001185bb91c4595ef1bde15e537c016edbd2a1.tar.gz firejail-f3001185bb91c4595ef1bde15e537c016edbd2a1.tar.zst firejail-f3001185bb91c4595ef1bde15e537c016edbd2a1.zip |
util.c: fix return type of get_group_id
gr_gid is of type gid_t (not uid_t). From grp.h(0p) of POSIX.1-2017:
> DESCRIPTION
>
> The <grp.h> header shall declare the group structure, which shall
> include the following members:
>
> char *gr_name The name of the group.
> gid_t gr_gid Numerical group ID.
> char **gr_mem Pointer to a null-terminated array of character
> pointers to member names.
>
> The <grp.h> header shall define the gid_t and size_t types as
> described in <sys/types.h>.
Note: The callers already store the result in gid_t variables.
First caused by commit dc3564b18 ("fixes", 2016-03-09).
-rw-r--r-- | src/firejail/firejail.h | 2 | ||||
-rw-r--r-- | src/firejail/util.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/firejail/firejail.h b/src/firejail/firejail.h index d29c2a976..c8d35c825 100644 --- a/src/firejail/firejail.h +++ b/src/firejail/firejail.h | |||
@@ -532,7 +532,7 @@ void update_map(char *mapping, char *map_file); | |||
532 | void wait_for_other(int fd); | 532 | void wait_for_other(int fd); |
533 | void notify_other(int fd); | 533 | void notify_other(int fd); |
534 | uid_t pid_get_uid(pid_t pid); | 534 | uid_t pid_get_uid(pid_t pid); |
535 | uid_t get_group_id(const char *group); | 535 | gid_t get_group_id(const char *group); |
536 | void flush_stdin(void); | 536 | void flush_stdin(void); |
537 | int create_empty_dir_as_user(const char *dir, mode_t mode); | 537 | int create_empty_dir_as_user(const char *dir, mode_t mode); |
538 | void create_empty_dir_as_root(const char *dir, mode_t mode); | 538 | void create_empty_dir_as_root(const char *dir, mode_t mode); |
diff --git a/src/firejail/util.c b/src/firejail/util.c index 1f5665cbc..87ca4c1e7 100644 --- a/src/firejail/util.c +++ b/src/firejail/util.c | |||
@@ -959,7 +959,7 @@ uid_t pid_get_uid(pid_t pid) { | |||
959 | } | 959 | } |
960 | 960 | ||
961 | 961 | ||
962 | uid_t get_group_id(const char *group) { | 962 | gid_t get_group_id(const char *group) { |
963 | gid_t gid = 0; | 963 | gid_t gid = 0; |
964 | struct group *g = getgrnam(group); | 964 | struct group *g = getgrnam(group); |
965 | if (g) | 965 | if (g) |