~ubuntu-branches/ubuntu/trusty/syslog-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to src/misc.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2010-03-28 19:47:36 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100328194736-1ob7kh1qr0fy8b9k
Tags: 3.1.0-1
* New upstream release.
* Fix path of syslog logfile (closes: #575722) and use tty10 instead of
  vc/10 to log on console.
* Provide syslog-ng in initscript (closes: #575723).

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
  return TRUE;
154
154
}
155
155
 
156
 
gboolean
157
 
resolve_sockaddr(gchar **result, GSockAddr *saddr, gboolean usedns, gboolean usefqdn, gboolean use_dns_cache, gboolean normalize_hostnames)
 
156
void
 
157
resolve_sockaddr(gchar *result, gsize *result_len, GSockAddr *saddr, gboolean usedns, gboolean usefqdn, gboolean use_dns_cache, gboolean normalize_hostnames)
158
158
{
159
159
  static gchar local_hostname[256] = "";
160
160
  gchar *hname;
234
234
        }
235
235
 
236
236
    }
237
 
  *result = normalize_hostnames ? g_ascii_strdown(hname, -1) : g_strdup(hname);
238
 
  return TRUE;
 
237
  if (normalize_hostnames)
 
238
    {
 
239
      gint i;
 
240
 
 
241
      for (i = 0; hname[i] && i < (*result_len); i++)
 
242
        {
 
243
          result[i] = g_ascii_tolower(hname[i]);
 
244
        }
 
245
      *result_len = i;
 
246
    }
 
247
  else
 
248
    {
 
249
      gsize len = g_strlcpy(result, hname, *result_len);
 
250
 
 
251
      if (len <= *result_len)
 
252
        *result_len = len;
 
253
    }
239
254
}
240
255
 
241
256
gboolean
355
370
  gchar *dirname;
356
371
  struct stat st;
357
372
  gint rc;
 
373
  gchar *p;
358
374
  
359
375
  /* check that the directory exists */
360
376
  dirname = g_path_get_dirname(name);
373
389
    }
374
390
    
375
391
  /* directory does not exist */
376
 
  char *p = name + 1;
 
392
  p = name + 1;
377
393
  
378
394
  p = strchr(p, '/');
379
395
  while (p) 
456
472
          ((((longword ^ cr_charmask) + magic_bits) ^ ~(longword ^ cr_charmask)) & ~magic_bits) != 0 || 
457
473
          ((((longword ^ lf_charmask) + magic_bits) ^ ~(longword ^ lf_charmask)) & ~magic_bits) != 0)
458
474
        {
 
475
          gint i;
 
476
 
459
477
          char_ptr = (gchar *) (longword_ptr - 1);
460
 
          gint i;
461
478
          
462
479
          for (i = 0; i < sizeof(longword); i++)
463
480
            {