diff options
author | Davide Cavalca <davide125@tiscali.it> | 2018-10-13 10:26:48 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-10-13 10:26:48 +0200 |
commit | b75f0c69b3c80ab1d80f907de96f1c1a444c171a (patch) | |
tree | c2320b5e58c405c571b9ddd565d52d134501cc6c /src/shared/specifier.c | |
parent | Merge pull request #10366 from poettering/in-set-fixes (diff) | |
download | systemd-b75f0c69b3c80ab1d80f907de96f1c1a444c171a.tar.xz systemd-b75f0c69b3c80ab1d80f907de96f1c1a444c171a.zip |
shared: add %g, %G specifiers for group / gid (#10368)
Diffstat (limited to 'src/shared/specifier.c')
-rw-r--r-- | src/shared/specifier.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/shared/specifier.c b/src/shared/specifier.c index b5f22c8d1e..78dda05b48 100644 --- a/src/shared/specifier.c +++ b/src/shared/specifier.c @@ -175,6 +175,24 @@ int specifier_kernel_release(char specifier, void *data, void *userdata, char ** return 0; } +int specifier_group_name(char specifier, void *data, void *userdata, char **ret) { + char *t; + + t = gid_to_name(getgid()); + if (!t) + return -ENOMEM; + + *ret = t; + return 0; +} + +int specifier_group_id(char specifier, void *data, void *userdata, char **ret) { + if (asprintf(ret, UID_FMT, getgid()) < 0) + return -ENOMEM; + + return 0; +} + int specifier_user_name(char specifier, void *data, void *userdata, char **ret) { char *t; |