Re: Errno checks for rmtree()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Errno checks for rmtree()
Дата
Msg-id 24650.1108256353@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Errno checks for rmtree()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Errno checks for rmtree()  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> + static void
> + rmtree_errno(char *filepath)
> + {
> +     if (errno == EACCES)
> + #ifndef FRONTEND
> +         elog(LOG, "no permission to remove \"%s\"", filepath);
> + #else
> +         fprintf(stderr, "no permission to remove \"%s\"", filepath);
> + #endif
> +     else if (errno == EBUSY)
> [ etc ]

This seems awfully bogus: it's incomplete and not in the style of our
other error messages.  Why not just one case:

#ifndef FRONTEND
    elog(LOG, "could not remove \"%s\": %m", filepath);
#else
    fprintf(stderr, "could not remove \"%s\": %s\n", filepath,
        strerror(errno));
#endif

Also, I'm unconvinced that LOG is the appropriate error level;
WARNING would probably be better.

            regards, tom lane

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [ADMIN] Migration of log features from 7.4 to 8.0
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Errno checks for rmtree()