Fix pg_upgrade's pg_scandir_internal() to properly handle a NULL
authorBruce Momjian <bruce@momjian.us>
Thu, 17 Nov 2011 18:24:54 +0000 (13:24 -0500)
committerBruce Momjian <bruce@momjian.us>
Thu, 17 Nov 2011 18:24:54 +0000 (13:24 -0500)
pattern, which is used on PG 9.1 and HEAD (but not pre-9.1).  Fixes
crash on Windows.

Backpatched to 9.1.

Reported by Mark Dilger

contrib/pg_upgrade/file.c

index c7b6f5cbfa3231026d6e587529a92cd788d21b2a..d3b0eaf2e28d39e0657e5272f22863dbab706587 100644 (file)
@@ -296,7 +296,7 @@ pg_scandir_internal(const char *dirname,
    while ((direntry = readdir(dirdesc)) != NULL)
    {
        /* Invoke the selector function to see if the direntry matches */
-       if ((*selector) (direntry))
+       if (selector && (*selector) (direntry))
        {
            count++;