/*
* client_write() ... Send binary data to the client.
*/
-int client_write(char *buf, int nbytes)
+int client_write(const char *buf, int nbytes)
{
int bytes_written = 0;
int retval;
return 0;
}
+void cputbuf(const StrBuf *Buf) {
+ client_write(ChrPtr(Buf), StrLength(Buf));
+}
+
/*
* cprintf() Send formatted printable data to the client.
* We don't just call close() because we don't want these fd's
* to be reused for other files.
*/
- chdir(ctdl_run_dir);
+ if (chdir(ctdl_run_dir) != 0)
+ CtdlLogPrintf(CTDL_EMERG,
+ "unable to change into directory [%s]: %s",
+ ctdl_run_dir, strerror(errno));
child = fork();
if (child != 0) {
setsid();
umask(0);
- freopen("/dev/null", "r", stdin);
- freopen("/dev/null", "w", stdout);
- freopen("/dev/null", "w", stderr);
+ if ((freopen("/dev/null", "r", stdin) != stdin) ||
+ (freopen("/dev/null", "w", stdout) != stdout) ||
+ (freopen("/dev/null", "w", stderr) != stderr))
+ CtdlLogPrintf(CTDL_EMERG,
+ "unable to reopen stdin/out/err %s",
+ strerror(errno));
+
do {
current_child = fork();
" For more information, please see:\n \n"
" http://citadel.org/doku.php/faq:mastering_your_os:gdb#how.do.i.make.my.system.produce.core-files"
"\n \n"
+"http://www.4players.de/4players.php/walkthrough/Wii/9298/24733/Die_Chroniken_von_Narnia_Prinz_Kaspian_von_Narnia.html"
+
" If you have already done this, the core dump is likely to be found at %score.%d\n"
,
ctdl_run_dir, ForkedPid);
ptr->state = CON_EXECUTING;
break;
}
- if ((bind_me == NULL) && (ptr->state == CON_STARTING)) {
+ if ((bind_me == NULL) && (ptr->state == CON_GREETING)) {
bind_me = ptr;
+ ptr->state = CON_STARTING;
break;
}
}
SO_REUSEADDR,
&i, sizeof(i));
- con->state = CON_STARTING;
+ con->state = CON_GREETING;
retval--;
if (retval == 0)