-const char jcc_rcs[] = "$Id: jcc.c,v 1.55 2001/11/13 20:14:53 jongfoster Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.58 2001/11/30 23:37:24 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
*
* Revisions :
* $Log: jcc.c,v $
+ * Revision 1.58 2001/11/30 23:37:24 jongfoster
+ * Renaming the Win32 config file to config.txt - this is almost the
+ * same as the corresponding UNIX name "config"
+ *
+ * Revision 1.57 2001/11/16 00:47:43 jongfoster
+ * Changing the tty-disconnection code to use setsid().
+ *
+ * Revision 1.56 2001/11/13 20:20:54 jongfoster
+ * Tabs->spaces, fixing a bug with missing {} around an if()
+ *
* Revision 1.55 2001/11/13 20:14:53 jongfoster
* Patch for FreeBSD setpgrp() as suggested by Alexander Lazic
*
csp->ip_addr_str, http->cmd);
}
+
/* Write the answer to the client */
if(rsp)
{
if(rsp)
{
- if ((write_socket(csp->cfd, rsp->head, n) != n)
+ if ((write_socket(csp->cfd, rsp->head, rsp->head_length) != rsp->head_length)
|| (write_socket(csp->cfd, rsp->body, rsp->content_length) != rsp->content_length))
{
log_error(LOG_LEVEL_ERROR, "write to: %s failed: %E", http->host);
#elif !defined(_WIN32)
"config"
#else
- "junkbstr.txt"
+ "config.txt"
#endif
;
#if defined(unix)
{
pid_t pid = 0;
+#if 0
int fd;
+#endif
/*
* we make us a real daemon
exit( 0 );
}
/* child */
+#if 1
+ /* Should be more portable, but not as well tested */
+ setsid();
+#else /* !1 */
#ifdef __FreeBSD__
setpgrp(0,0);
-#else
+#else /* ndef __FreeBSD__ */
setpgrp();
-#endif
+#endif /* ndef __FreeBSD__ */
fd = open("/dev/tty", O_RDONLY);
if ( fd )
{
ioctl( fd, TIOCNOTTY,0 );
close ( fd );
}
+#endif /* !1 */
/* should close stderr (fd 2) here too, but the test for existence
** and load config file is done in listen_loop() and puts
** some messages on stderr there.