diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2017-03-14 16:38:12 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2017-03-14 16:38:12 +0100 |
commit | ba8b9705d15936664a57cfef4772931a0f70ba93 (patch) | |
tree | e7d75ae4e82b532ba0d594d6e598dd7eaae2700a /vconsole.c | |
parent | 52ef709b258be2927c74e916ed936bc3749078a7 (diff) | |
download | vconsole-ba8b9705d15936664a57cfef4772931a0f70ba93.tar.gz |
close file handles before exec
Diffstat (limited to 'vconsole.c')
-rw-r--r-- | vconsole.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -300,6 +300,14 @@ static struct vconsole_domain *find_guest(struct vconsole_window *win) return dom; } +static void prepare_exec(void) +{ + int i; + + for (i = 3; i < 1024; i++) + close(i); +} + static void run_virt_viewer(struct vconsole_domain *dom, bool reconnect) { @@ -326,6 +334,7 @@ static void run_virt_viewer(struct vconsole_domain *dom, return; } else { /* child */ + prepare_exec(); execvp("virt-viewer", argv); perror("execvp"); exit(1); @@ -356,6 +365,7 @@ static void run_virsh_edit(struct vconsole_domain *dom) return; } else { /* child */ + prepare_exec(); execvp("xterm", argv); perror("execvp"); exit(1); @@ -485,6 +495,7 @@ static void menu_cb_manual(GtkAction *action, gpointer userdata) return; } else { /* child */ + prepare_exec(); execlp("xdg-open", "xdg-open", "man:vconsole(1)", NULL); perror("execlp"); exit(1); |