Pull logging prefix from program name from argv[0]
[guacd.git] / src / daemon.c
index 06e9892..aff36e0 100644 (file)
@@ -48,6 +48,7 @@
 
 #include <errno.h>
 #include <syslog.h>
+#include <libgen.h>
 
 #include <guacamole/client.h>
 #include <guacamole/error.h>
@@ -227,6 +228,10 @@ int main(int argc, char* argv[]) {
         }
     }
 
+    /* Set up logging prefix */
+    strncpy(log_prefix, basename(argv[0]), sizeof(log_prefix));
+
+
     /* Get addresses for binding */
     if ((retval = getaddrinfo(listen_address, listen_port, &hints, &addresses))) {
         guacd_log_error("Error parsing given address or port: %s",