Skip to content

Commit

Permalink
xdp_validate_sound: Assign argument indices automatically
Browse files Browse the repository at this point in the history
Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv committed Oct 30, 2024
1 parent 709c962 commit bff94c7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/xdp-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ xdp_validate_sound (XdpSealedFd *sound)
g_autoptr(GKeyFile) key_file = NULL;
g_autofree char *output = NULL;
const char *sound_validator = LIBEXECDIR "/xdg-desktop-portal-validate-sound";
gsize i;

if (g_getenv ("XDP_VALIDATE_SOUND"))
sound_validator = g_getenv ("XDP_VALIDATE_SOUND");
Expand All @@ -663,11 +664,13 @@ xdp_validate_sound (XdpSealedFd *sound)
return FALSE;
}

args[0] = sound_validator;
args[1] = "--sandbox";
args[2] = "--fd";
args[3] = G_STRINGIFY (VALIDATOR_INPUT_FD);
args[4] = NULL;
i = 0;
args[i++] = sound_validator;
args[i++] = "--sandbox";
args[i++] = "--fd";
args[i++] = G_STRINGIFY (VALIDATOR_INPUT_FD);
g_assert (i < G_N_ELEMENTS (args));
args[i++] = NULL;

output = xdp_spawn_full (args, xdp_sealed_fd_dup_fd (sound), VALIDATOR_INPUT_FD, &error);
if (!output)
Expand Down

0 comments on commit bff94c7

Please sign in to comment.