Skip to content

Commit

Permalink
Add some error checking
Browse files Browse the repository at this point in the history
(cherry picked from commit 7ce5564)
  • Loading branch information
DemiMarie authored and marmarek committed May 12, 2023
1 parent 90667fc commit 490130c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions agent/qrexec-client-vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "libqrexec-utils.h"
#include "qrexec.h"
#include "qrexec-agent.h"
#include <err.h>

const bool qrexec_is_fork_server = false;

Expand Down Expand Up @@ -272,10 +273,10 @@ int main(int argc, char **argv)
}
}

dup2(inpipe[0], 0);
dup2(outpipe[1], 1);
close(inpipe[0]);
close(outpipe[1]);
if (dup2(inpipe[0], 0) != 0 || dup2(outpipe[1], 1) != 1)
err(1, "dup2()");
if (close(inpipe[0]) || close(outpipe[1]))
err(1, "close()");

abs_exec_path = strdup(argv[optind + 2]);
argv[optind + 2] = get_program_name(argv[optind + 2]);
Expand Down

0 comments on commit 490130c

Please sign in to comment.