File syslog-ng-update_own_hostname.dif of Package syslog-ng

--- src/main.c
+++ src/main.c	2008/02/27 11:35:38
@@ -169,6 +169,7 @@ main_loop_run(GlobalConfig **cfg)
       if (sig_hup_received)
         {
           msg_notice("Configuration reload request received, reloading configuration", NULL);
+          update_local_hostname();
           (*cfg) = cfg_reload_config(cfgfilename, (*cfg), additional_sockets);
           sig_hup_received = FALSE;
           if ((*cfg)->stats_freq > 0)
--- src/misc.c
+++ src/misc.c	2008/02/26 17:46:46
@@ -124,6 +124,12 @@ get_local_timezone_ofs(time_t when)
   return tzoff;
 }
 
+static int update_local_hostname_now = 0;
+void update_local_hostname(void)
+{
+	update_local_hostname_now = 1;
+}
+
 gboolean
 resolve_hostname(GString *result, GSockAddr *saddr, gboolean usedns, gboolean usefqdn, gboolean use_dns_cache)
 {
@@ -193,8 +199,9 @@ resolve_hostname(GString *result, GSockA
     }
   else 
     {
-      if (!local_hostname[0]) 
+      if (!local_hostname[0] || update_local_hostname_now) 
 	{
+	  update_local_hostname_now = 0;
           if (usefqdn)
             getlonghostname(local_hostname, sizeof(local_hostname));
           else
--- src/misc.h
+++ src/misc.h	2008/02/26 17:46:36
@@ -43,5 +43,6 @@ gboolean resolve_user(const char *user, 
 gboolean resolve_group(const char *group, gid_t *gid);
 gboolean resolve_user_group(char *arg, uid_t *uid, gid_t *gid);
 gboolean resolve_hostname(GString *result, GSockAddr *saddr, gboolean usedns, gboolean usefqdn, gboolean use_dns_cache);
+void update_local_hostname(void);
 
 #endif
openSUSE Build Service is sponsored by