aboutsummaryrefslogtreecommitdiffstats
path: root/daemon/main.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--daemon/main.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/daemon/main.c b/daemon/main.c
index 91e9087..ee91238 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -28,7 +28,10 @@
HANDLE service_stop_event;
-char local_hostname[ MAX_COMPUTERNAME_LENGTH + 1 ];
+struct string *local_hostname;
+struct string *self_program_name;
+struct string *space;
+struct string *line_feed;
int verbosity_level = 0;
@@ -468,10 +471,15 @@ int main( int argc, char* argv[] )
char *priority = NULL;
int getopt_failure = 0;
WSADATA wsd;
+ char name_buf[ MAX_COMPUTERNAME_LENGTH + 1 ];
DWORD size;
SetUnhandledExceptionFilter( exception_handler );
+ self_program_name = string_new( "syslog" );
+ space = string_new( " " );
+ line_feed = string_new( "\n" );
+
if( WSAStartup( MAKEWORD( 2, 2 ), &wsd ) )
{
ERR( "Cannot initialize winsock; error %lu\n", WSAGetLastError() );
@@ -479,13 +487,13 @@ int main( int argc, char* argv[] )
}
/* get local host name */
- size = sizeof(local_hostname);
- if( !GetComputerName( local_hostname, &size ) )
+ size = sizeof(name_buf);
+ if( !GetComputerName( name_buf, &size ) )
{
ERR( "Cannot get computer name; error %lu\n", GetLastError() );
return 1;
}
- TRACE( "local host name=%s\n", local_hostname );
+ local_hostname = string_new_len( name_buf, size );
/* get windows version */
vi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
@@ -581,6 +589,8 @@ int main( int argc, char* argv[] )
if( getopt_failure )
return 1;
+ TRACE( "local host name=%s\n", local_hostname->gstr->str );
+
/* handle flags in order of priority */
/* at first, check instance name */
if( instance_name )