I believe in sandboxing, I hope it gets better and easier to use. I work on several C programs. I wish for the day when we have an easy to use, cross platform method of setting up a small set of open files at the start of a program, then be able to say "No more file access, no more network connections". I know this hides a whole bunch of complication, which is why it's hard and why there are so many ways to do it --…
You could potentially use setrlimit on RLIMIT_NOFILE to limit your number of open files.
Although... you probably still want to display something to the terminal which means you still want stdout and stderr, so an attacker could just close stdout and stderr before doing whatever they wanted with their 2 remaining fds.