Re: Badly designed error reporting code in controldata_utils.c

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Badly designed error reporting code in controldata_utils.c
Дата
Msg-id 56DDA625.8020709@joeconway.com
обсуждение исходный текст
Ответ на Re: Badly designed error reporting code in controldata_utils.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Badly designed error reporting code in controldata_utils.c  (Joe Conway <mail@joeconway.com>)
Список pgsql-hackers
On 03/06/2016 07:34 PM, Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>> On 03/06/2016 05:47 PM, Tom Lane wrote:
>>> That's much better, but is there a reason you're using exit(2)
>>> and not exit(EXIT_FAILURE) ?
>
>> Only because I was trying to stick with what was originally in
>> src/bin/pg_controldata/pg_controldata.c
>
> Meh.  It looks to me like the standard way to handle this
> for code in src/common/ is exit(EXIT_FAILURE).

I have no issue with using EXIT_FAILURE, but note:

1) That will change the exit error from the previous value of 2 to 1 for  pg_controldata

2) There are many examples in other parts of the source that do not use  EXIT_FAILURE, and even in src/common:

8<-------------
grep -rnE "exit\(EXIT_FAILURE\)" src/common/* --include=*.c
src/common/fe_memutils.c:36:                    exit(EXIT_FAILURE);
src/common/fe_memutils.c:76:            exit(EXIT_FAILURE);
src/common/fe_memutils.c:93:            exit(EXIT_FAILURE);
src/common/fe_memutils.c:99:            exit(EXIT_FAILURE);
src/common/psprintf.c:135:              exit(EXIT_FAILURE);
src/common/psprintf.c:182:              exit(EXIT_FAILURE);

grep -rnE "exit\((1|2)\)" src/common/* --include=*.c
src/common/restricted_token.c:187:                              exit(1);
src/common/username.c:86:               exit(1);
8<-------------

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: WIP: Upper planner pathification
Следующее
От: Tom Lane
Дата:
Сообщение: Re: WIP: Upper planner pathification