char TERM_msg[] = "2999 Terminate\n";
-#ifdef HAVE_CYGWIN
-int win32_client = 1;
+#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
+const int win32_client = 1;
#else
-int win32_client = 0;
+const int win32_client = 0;
#endif
* Main Bacula Unix Client Program
*
*/
-#ifdef HAVE_CYGWIN
+#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
#define main BaculaMain
#endif
+
int main (int argc, char *argv[])
{
int ch;
/* Maximum 1 daemon at a time */
create_pid_file(me->pid_directory, "bacula-fd", me->FDport);
+ read_state_file(me->working_directory, "bacula-fd", me->FDport);
drop(uid, gid);
if (inetd_request) {
/* Socket is on fd 0 */
- BSOCK *bs = init_bsock(NULL, 0, "client", "unknown client", me->FDport);
+ struct sockaddr_in client_addr;
+ memset(&client_addr, 0, sizeof(client_addr));
+ BSOCK *bs = init_bsock(NULL, 0, "client", "unknown client", me->FDport,
+ &client_addr);
handle_client_request((void *)bs);
} else {
/* Become server, and handle requests */
&dir_workq, handle_client_request);
}
- term_msg();
+ terminate_filed(0);
exit(0); /* should never get here */
}
if (debug_level > 5) {
print_memory_pool_stats();
}
+ write_state_file(me->working_directory, "bacula-fd", me->FDport);
delete_pid_file(me->pid_directory, "bacula-fd", me->FDport);
free_config_resources();
term_msg();