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 ...
regards, tom lane