Re: Errno checks for rmtree()

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Errno checks for rmtree()
Дата
Msg-id 200502130123.j1D1Nud27581@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Errno checks for rmtree()  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Errno checks for rmtree()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Tom Lane wrote:
> 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

OK, so you just wanted _an_ error string to be printed on failure rather
than the reasons.

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

Yea, good point.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Errno checks for rmtree()
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Errno checks for rmtree()