execnofd.c: run a program on Linux after closing all fds

Hacked this up to solve a little problem at work. All it does is close all file descriptors above 2 and exec the program specified on the command line. You can use it like this:

execnofd /usr/bin/foo

Here's the gist:


Popular posts from this blog

Monitoring with statsd and CloudWatch

Xen, "hwcap 0 nosegneg", and -mno-tls-direct-seg-refs

A Grand Adventure: compiling transmission on my home router