Skip site navigation (1) Skip section navigation (2)

Re: Errno checks for rmtree()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Errno checks for rmtree()
Date: 2005-02-13 00:59:13
Message-ID: 24650.1108256353@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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

In response to

Responses

pgsql-patches by date

Next:From: Bruce MomjianDate: 2005-02-13 01:23:56
Subject: Re: Errno checks for rmtree()
Previous:From: Bruce MomjianDate: 2005-02-12 23:48:18
Subject: Re: [ADMIN] Migration of log features from 7.4 to 8.0

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group