[syslog-ng] [PATCH] typo in misc.c, function resolve_user?

Corinna Vinschen vinschen at redhat.com
Wed Mar 25 17:18:12 CET 2009


Hi,

a Cygwin user got a message in the syslog every time the syslog-ng
service started up:

  Error resolving user; user='system'

He also found why this message was generated.  The function resolve_user()
in misc.c appears to have a typo.  If the incoming user argument points
to a non-empty string, resolve_user() just returns NULL.  So, the following
getpwnam is only called for an empty user string.  This looks like a typo.

One possible fix below.  However, maybe the intention was actually to
test for

  if (!user)

instead of

  if (!*user)

???


Corinna


--- src/misc.c.ORIG	2009-03-25 17:01:15.000000000 +0100
+++ src/misc.c	2009-03-25 17:01:29.000000000 +0100
@@ -274,7 +274,7 @@ resolve_user(const char *user, uid_t *ui
   struct passwd *pw;
 
   *uid = 0;
-  if (*user)
+  if (!*user)
     return FALSE;
     
   pw = getpwnam(user);


-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


More information about the syslog-ng mailing list