[pulseaudio-discuss] [PATCH 1/2] pa_make_secure_dir: avoid calling fchmod if already right mode

Arun Raghavan arun at accosted.net
Sun Oct 18 20:23:29 PDT 2015


On Sat, 2015-10-10 at 20:11 +0100, Julien Isorce wrote:
> fchmod is denied in chromium sandbox.
> ---
>  src/pulsecore/core-util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
> index 278ad63..f694347 100644
> --- a/src/pulsecore/core-util.c
> +++ b/src/pulsecore/core-util.c
> @@ -343,7 +343,7 @@ again:
>  #endif
>  
>  #ifdef HAVE_FCHMOD
> -    if (fchmod(fd, m) < 0) {
> +    if ((st.st_mode & 0x0FFF) != m && fchmod(fd, m) < 0) {
>          pa_assert_se(pa_close(fd) >= 0);
>          goto fail;
>      };

I'm pushing this out with some minor changes. The commit log is made to
be more consistent with previous commits.

I also switched 0xFFFF to 07777 since that's the more common convention
with mode-related variables (this really is a nitpick, though!)

-- Arun


More information about the pulseaudio-discuss mailing list