summaryrefslogtreecommitdiffstats
path: root/email.c
diff options
context:
space:
mode:
authorroot <root@ka-ata-killa.panaceas.james.internal>2022-04-09 11:57:42 +0100
committerroot <root@ka-ata-killa.panaceas.james.internal>2022-04-09 11:57:42 +0100
commit338dcccc8d8532a446fa60dc65092b5510c06e3a (patch)
tree85c40cfec1a44b43a278d164f6a6c20576fd8aba /email.c
parentc44cf3a3f0a73ad276c0316759fcb0d8a0d22032 (diff)
downloadgalaxy_tools-338dcccc8d8532a446fa60dc65092b5510c06e3a.tar.gz
galaxy_tools-338dcccc8d8532a446fa60dc65092b5510c06e3a.tar.bz2
galaxy_tools-338dcccc8d8532a446fa60dc65092b5510c06e3a.zip
various improvementsHEADmaster
Diffstat (limited to 'email.c')
-rw-r--r--email.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/email.c b/email.c
index 0ee47ff..7374c34 100644
--- a/email.c
+++ b/email.c
@@ -8,60 +8,11 @@
#include <sys/wait.h>
+#include "util.h"
#include "email.h"
-static int daemonish (int nochdir, int noclose)
-{
- pid_t pid;
- int status;
-
- if (!nochdir && chdir ("/"))
- return -1;
-
- if (!noclose) {
- int fd, failed = 0;
-
- if ((fd = open ("/dev/null", O_RDWR)) < 0) return -1;
-
- if (dup2 (fd, 0) < 0 || dup2 (fd, 1) < 0 || dup2 (fd, 2) < 0)
- failed++;
-
- if (fd > 2) close (fd);
-
- if (failed) return -1;
- }
-
- switch ((pid = fork())) {
- case 0:
- break;
-
- case -1:
- return -1;
-
- default:
- waitpid (pid, &status, 0);
- return 1;;
- }
-
- if (setsid() < 0) return -1;
-
- switch (fork()) {
- case 0:
- break;
-
- case -1:
- return -1;
-
- default:
- _exit (0);
- }
-
- return 0;
-}
-
-
static void write_complete (int fd, const void *_buf, size_t len)
{
ssize_t writ;