pgsql: Fix a number of places that were making file-type tests

Поиск
Список
Период
Сортировка
От tgl@postgresql.org (Tom Lane)
Тема pgsql: Fix a number of places that were making file-type tests
Дата
Msg-id 20080331013248.C20A07558E7@cvs.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
Fix a number of places that were making file-type tests infelicitously.
The places that did, eg,
    (statbuf.st_mode & S_IFMT) == S_IFDIR
were correct, but there is no good reason not to use S_ISDIR() instead,
especially when that's what the other 90% of our code does.  The places
that did, eg,
    (statbuf.st_mode & S_IFDIR)
were flat out *wrong* and would fail in various platform-specific ways,
eg a symlink could be mistaken for a regular file on most Unixen.

The actual impact of this is probably small, since the problem cases
seem to always involve symlinks or sockets, which are unlikely to be
found in the directories that PG code might be scanning.  But it's
clearly trouble waiting to happen, so patch all the way back anyway.
(There seem to be no occurrences of the mistake in 7.4.)

Tags:
----
REL8_1_STABLE

Modified Files:
--------------
    pgsql/src/backend/utils/adt:
        dbsize.c (r1.7.2.1 -> r1.7.2.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/dbsize.c?r1=1.7.2.1&r2=1.7.2.2)
        genfile.c (r1.9 -> r1.9.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/genfile.c?r1=1.9&r2=1.9.2.1)
    pgsql/src/port:
        copydir.c (r1.16 -> r1.16.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/port/copydir.c?r1=1.16&r2=1.16.2.1)
        exec.c (r1.39.2.1 -> r1.39.2.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/port/exec.c?r1=1.39.2.1&r2=1.39.2.2)

В списке pgsql-committers по дате отправления:

Предыдущее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Fix a number of places that were making file-type tests
Следующее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Fix a number of places that were making file-type tests