[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: set +p exits 31
From: |
Grisha Levit |
Subject: |
Re: set +p exits 31 |
Date: |
Fri, 30 Jun 2023 16:09:04 -0400 |
On Fri, Jun 30, 2023, 12:12 Chet Ramey <chet.ramey@case.edu> wrote:
> On 6/30/23 3:10 AM, Grisha Levit wrote:
>
> > This is a problem with (at least some) Android versions. The setresgid
> and
> > setgid functions are in the C library, but actually calling it causes a
> > SIGSYS (Bad system call) signal to be sent.
> >
> > This occasionally gets me too, attached is a patch that works around the
> > issue by not bothering to call the set*id functions when the effective
> IDs
> > already match real ones.
>
> This isn't exactly correct for the setresuid case, since it's possible
> for the saved setuid not to match euid and uid, and you want to change
> them all.
>
Sorry, you're right, didn't really think that through. Attached patch
switches to using getres[ug]id when setres[ug]id is available and stores
the saved ids.
0001-avoid-calling-setgid-when-ids-already-match.patch
Description: Text Data