Some comments

This commit is contained in:
Stefan Bühler 2008-07-20 23:18:26 +02:00
parent b9b8fcd563
commit 8a82a62528

View File

@ -75,7 +75,7 @@ typedef struct {
gchar *pid_file; gchar *pid_file;
gboolean no_fork; gboolean no_fork;
gboolean show_version; gboolean show_version;
gboolean keep_fds, close_fds; /* keep/close STDIN/STDOUT */ gboolean keep_fds, close_fds; /* keep/close STDOUT/STDERR */
gchar *chroot; gchar *chroot;
gchar *uid, *gid; gchar *uid, *gid;
@ -347,6 +347,7 @@ int drop_priv() {
return 0; return 0;
} }
/* move a fd to another and close the old one */
void move2fd(int srcfd, int dstfd) { void move2fd(int srcfd, int dstfd) {
if (srcfd != dstfd) { if (srcfd != dstfd) {
close(dstfd); close(dstfd);
@ -355,6 +356,7 @@ void move2fd(int srcfd, int dstfd) {
} }
} }
/* replace an fd with /dev/null */
void move2devnull(int fd) { void move2devnull(int fd) {
move2fd(open("/dev/null", O_RDWR), fd); move2fd(open("/dev/null", O_RDWR), fd);
} }