mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-03-01 09:50:31 +00:00
abuild-sudo: handle errors from setuid/setgid
ref https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10102
This commit is contained in:
parent
1332d5b171
commit
fcdfd871af
@ -125,9 +125,11 @@ int main(int argc, const char *argv[])
|
|||||||
|
|
||||||
argv[0] = path;
|
argv[0] = path;
|
||||||
/* set our uid to root so bbsuid --install works */
|
/* set our uid to root so bbsuid --install works */
|
||||||
setuid(0);
|
if (setuid(0) < 0)
|
||||||
|
err(1, "setuid(0) failed");
|
||||||
/* set our gid to root so apk commit hooks run with the same gid as for "sudo apk add ..." */
|
/* set our gid to root so apk commit hooks run with the same gid as for "sudo apk add ..." */
|
||||||
setgid(0);
|
if (setgid(0) < 0)
|
||||||
|
err(1, "setgid(0) failed");
|
||||||
execv(path, (char * const*)argv);
|
execv(path, (char * const*)argv);
|
||||||
perror(path);
|
perror(path);
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user