Re: system() patch for Win32

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: system() patch for Win32
Date: 2003-04-03 14:43:27
Message-ID: 28282.1049381007@sss.pgh.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:
> Here is a patch to handle 'rm', 'cp', and 'exec' usage by system();
> again very small.

This part seems unnecessarily obscurantist:

> ! #ifndef WIN32
> ! #define EXEC "exec "
> ! #else
> ! #define EXEC ""
> ! #endif

> ! sprintf(sys, "%s%s '%s'", EXEC, editorName, fname);

I like the other style (just #ifdef to choose one of two sprintf
commands) better. It seems easier to understand, as well as less
fragile --- the way you have it here makes it *real* easy to break
the computation of the buffer size for the command string.

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-04-03 14:47:42 Re: Win32 defines
Previous Message Bruce Momjian 2003-04-03 06:14:40 Win32 defines