Re: Remove sort files

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Remove sort files
Date: 2001-05-24 00:15:00
Message-ID: 200105240015.f4O0F0F29409@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > OK, here is the new code:
>
> > snprintf(clear_pg_sorttemp, sizeof(clear_pg_sorttemp),
> > "sh -c '\
> > cd \"%s\"/base && \
> > ls | while read DIR; \
> > do \
> > export DIR; \
> > (cd \"$DIR\"/pg_sorttemp/ 2>/dev/null && rm -f *); \
> > done'",
> > DataDir);
>
> A readdir() loop would be hardly any longer, and it'd be faster and more
> secure. Among other problems with the above code, we do not prohibit
> double-quote in database paths anymore ...

OK, I did the readdir() thing. I hope it is safe to unlink a file while
in a readdir() loop.

Patch attached.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Attachment Content-Type Size
unknown_filename text/plain 4.4 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Ian Lance Taylor 2001-05-24 00:46:43 Re: Remove sort files
Previous Message Ned Wolpert 2001-05-23 21:09:07 Re: [JDBC] ANT fix for jar creation