Skip to content

Commit

Permalink
Use O_CLOEXEC | O_NOCTTY to open a directory
Browse files Browse the repository at this point in the history
There is no good reason not to use these flags.
  • Loading branch information
DemiMarie committed May 27, 2024
1 parent f5f7269 commit 5a0d47b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion qubes-rpc/qfile-unpacker.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int main(int argc, char ** argv)
if (asprintf(&procdir_path, "/proc/%d/fd", getpid()) < 0) {
gui_fatal("Error allocating memory");
}
procfs_fd = open(procdir_path, O_DIRECTORY | O_RDONLY);
procfs_fd = open(procdir_path, O_DIRECTORY | O_RDONLY | O_NOCTTY | O_CLOEXEC);
if (procfs_fd < 0)
perror("Failed to open /proc");
else
Expand Down

0 comments on commit 5a0d47b

Please sign in to comment.