Fix a segfault
authorVolker Lendecke <vl@samba.org>
Tue, 22 Jan 2008 08:13:25 +0000 (09:13 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 22 Jan 2008 08:16:28 +0000 (09:16 +0100)
Found by the IBM checker.

Jeremy, you changed this from 'dirname == 0' which does not make sense at all
in the old code to '!dirname == 0' which from my point of view makes even less
sense, because the precedence of ! is according to Harbison/Steele higher than
the precedence of ==. Please check that the code now actually does what it's
supposed to do.

Thanks!
(This used to be commit c8def5564739c4c754001f84fcfb77f1093b96c3)

source3/smbd/utmp.c

index e82bbea3b301f6991aae11e6dfbc6a5ec8c9fb7b..5931b2b1d06e2717202e219fb2e0a733953e66af 100644 (file)
@@ -223,7 +223,7 @@ static char *uw_pathname(TALLOC_CTX *ctx,
        }
 
        /* For u-files and non-explicit w-dir, look for "utmp dir" */
-       if (!dirname == 0 || strlen(dirname) == 0) {
+       if ((dirname == NULL) || (strlen(dirname) == 0)) {
                dirname = talloc_strdup(ctx, lp_utmpdir());
                if (!dirname) {
                        return NULL;