Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop accidental leakage of /dev/null fd to child procs #68

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sdorfehs.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ init_defaults(void)
int
main(int argc, char *argv[])
{
int c;
int c, fd;
char **cmd = NULL;
int cmd_count = 0;
char *display = NULL;
Expand Down Expand Up @@ -287,7 +287,9 @@ main(int argc, char *argv[])
set_close_on_exec(ConnectionNumber(dpy));

/* forked commands should not get X console tty as their stdin */
dup2(open("/dev/null", O_RDONLY), STDIN_FILENO);
fd = open("/dev/null", O_RDONLY);
dup2(fd, STDIN_FILENO);
close(fd);

/* Set our own specific Atoms. */
rp_selection = XInternAtom(dpy, "RP_SELECTION", False);
Expand Down
Loading