ErrAndDie("bwnfsd: Spool area mount point %s could not be mounted.\nbwnfsd: Check that %s is in the /etc/exports file & world-writable\n", *argv, *argv);
if (!debugmode) {
#ifdef SIGTTOU
signal(SIGTTOU, SIG_IGN);
#endif
#ifdef SIGTTIN
signal(SIGTTIN, SIG_IGN);
#endif
#ifdef SIGTSTP
signal(SIGTSTP, SIG_IGN);
#endif
if ((child_pid=fork()) > 0)
exit(0);
if (child_pid < 0)
ErrAndDie("bwnfsd: Unable to detach process\n", NULL, NULL);
if (setpgrp(0, 0) == -1)
ErrAndDie("bwnfsd: [main] Can't change process group\n", NULL, NULL);
#ifdef SIGTSTP
#ifdef TIOCNOTTY
if ((i=open("/dev/tty", O_RDWR)) >= 0) {
ioctl(i, TIOCNOTTY, NULL);
close(i);
}
#endif
#else
signal(SIGHUP, SIG_IGN);
if ((child_pid=fork()) > 0)
exit(0);
if (child_pid < 0)
ErrAndDie("bwnfsd: [main] Unable to detach second process\n", NULL, NULL);
#endif
#ifndef NOFILE
#define NOFILE 10
#endif
for (i=0; i<NOFILE; i++)
close(i);
errno = 0;
chdir("/");
umask(0);
if ((i=open("/dev/null", O_RDWR)) < 0)
ErrAndDie("bwnfsd: [main] Unable to map handles\n", NULL, NULL);
dup2(i, 4);
close(i);
dup2(4, 0);
dup2(4, 1);
dup2(4, 2);
close(4);
}
if (determine_print_command() == 0)
ErrAndDie("bwnfsd: [main] Unable to determine print command\n", NULL, NULL);
p = strcpy(spool_dir,*argv) + strlen(*argv);
if (*(p-1) == '/')
*(--p) = '\0';
get_printers();
get_groups();
f.status = 0;
f.dir_size = 32;
f.dir_handle = dir;
transp = (SVCXPRT *)svcudp_create(RPC_ANYSOCK);
if (transp == NULL)
ErrAndDie("bwnfsd: [main] Unable to create an RPC server\n", NULL, NULL);