mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
Replace SYSTEMQUOTEs with Windows-specific wrapper functions.
It's easy to forget using SYSTEMQUOTEs when constructing command strings for system() or popen(). Even if we fix all the places missing it now, it is bound to be forgotten again in the future. Introduce wrapper functions that do the the extra quoting for you, and get rid of SYSTEMQUOTEs in all the callers. We previosly used SYSTEMQUOTEs in all the hard-coded command strings, and this doesn't change the behavior of those. But user-supplied commands, like archive_command, restore_command, COPY TO/FROM PROGRAM calls, as well as pgbench's \shell, will now gain an extra pair of quotes. That is desirable, but if you have existing scripts or config files that include an extra pair of quotes, those might need to be adjusted. Reviewed by Amit Kapila and Tom Lane
This commit is contained in:
@ -137,7 +137,7 @@ ecpg_start_test(const char *testname,
|
||||
snprintf(inprg, sizeof(inprg), "%s/%s", inputdir, testname);
|
||||
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
SYSTEMQUOTE "\"%s\" >\"%s\" 2>\"%s\"" SYSTEMQUOTE,
|
||||
"\"%s\" >\"%s\" 2>\"%s\"",
|
||||
inprg,
|
||||
outfile_stdout,
|
||||
outfile_stderr);
|
||||
|
@ -38,7 +38,7 @@ OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
|
||||
OBJS += chklocale.o inet_net_ntop.o noblock.o pgstrcasecmp.o pqsignal.o \
|
||||
thread.o
|
||||
# libpgport C files that are needed if identified by configure
|
||||
OBJS += $(filter crypt.o getaddrinfo.o getpeereid.o inet_aton.o open.o snprintf.o strerror.o strlcpy.o win32error.o win32setlocale.o, $(LIBOBJS))
|
||||
OBJS += $(filter crypt.o getaddrinfo.o getpeereid.o inet_aton.o open.o system.o snprintf.o strerror.o strlcpy.o win32error.o win32setlocale.o, $(LIBOBJS))
|
||||
# backend/libpq
|
||||
OBJS += ip.o md5.o
|
||||
# utils/mb
|
||||
@ -89,7 +89,7 @@ backend_src = $(top_srcdir)/src/backend
|
||||
# For some libpgport modules, this only happens if configure decides
|
||||
# the module is needed (see filter hack in OBJS, above).
|
||||
|
||||
chklocale.c crypt.c getaddrinfo.c getpeereid.c inet_aton.c inet_net_ntop.c noblock.c open.c pgsleep.c pgstrcasecmp.c pqsignal.c snprintf.c strerror.c strlcpy.c thread.c win32error.c win32setlocale.c: % : $(top_srcdir)/src/port/%
|
||||
chklocale.c crypt.c getaddrinfo.c getpeereid.c inet_aton.c inet_net_ntop.c noblock.c open.c system.c pgsleep.c pgstrcasecmp.c pqsignal.c snprintf.c strerror.c strlcpy.c thread.c win32error.c win32setlocale.c: % : $(top_srcdir)/src/port/%
|
||||
rm -f $@ && $(LN_S) $< .
|
||||
|
||||
ip.c md5.c: % : $(backend_src)/libpq/%
|
||||
@ -150,7 +150,7 @@ clean distclean: clean-lib
|
||||
# Might be left over from a Win32 client-only build
|
||||
rm -f pg_config_paths.h
|
||||
rm -f inet_net_ntop.c noblock.c pgstrcasecmp.c pqsignal.c thread.c
|
||||
rm -f chklocale.c crypt.c getaddrinfo.c getpeereid.c inet_aton.c open.c snprintf.c strerror.c strlcpy.c win32error.c win32setlocale.c
|
||||
rm -f chklocale.c crypt.c getaddrinfo.c getpeereid.c inet_aton.c open.c system.c snprintf.c strerror.c strlcpy.c win32error.c win32setlocale.c
|
||||
rm -f pgsleep.c
|
||||
rm -f md5.c ip.c
|
||||
rm -f encnames.c wchar.c
|
||||
|
@ -106,6 +106,7 @@ CLEAN :
|
||||
-@erase "$(INTDIR)\dirmod.obj"
|
||||
-@erase "$(INTDIR)\pgsleep.obj"
|
||||
-@erase "$(INTDIR)\open.obj"
|
||||
-@erase "$(INTDIR)\system.obj"
|
||||
-@erase "$(INTDIR)\win32error.obj"
|
||||
-@erase "$(OUTDIR)\$(OUTFILENAME).lib"
|
||||
-@erase "$(OUTDIR)\$(OUTFILENAME)dll.lib"
|
||||
@ -149,6 +150,7 @@ LIB32_OBJS= \
|
||||
"$(INTDIR)\dirmod.obj" \
|
||||
"$(INTDIR)\pgsleep.obj" \
|
||||
"$(INTDIR)\open.obj" \
|
||||
"$(INTDIR)\system.obj" \
|
||||
"$(INTDIR)\win32error.obj" \
|
||||
"$(INTDIR)\pthread-win32.obj"
|
||||
|
||||
@ -295,6 +297,11 @@ LINK32_FLAGS = -Gn -L$(BCB)\lib;$(INTDIR); -x -Tpd -v
|
||||
$(CPP_PROJ) /I"." ..\..\port\open.c
|
||||
<<
|
||||
|
||||
"$(INTDIR)\system.obj" : ..\..\port\system.c
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) /I"." ..\..\port\system.c
|
||||
<<
|
||||
|
||||
"$(INTDIR)\win32error.obj" : ..\..\port\win32error.c
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) /I"." ..\..\port\win32error.c
|
||||
|
@ -113,6 +113,7 @@ CLEAN :
|
||||
-@erase "$(INTDIR)\dirmod.obj"
|
||||
-@erase "$(INTDIR)\pgsleep.obj"
|
||||
-@erase "$(INTDIR)\open.obj"
|
||||
-@erase "$(INTDIR)\system.obj"
|
||||
-@erase "$(INTDIR)\win32error.obj"
|
||||
-@erase "$(INTDIR)\win32setlocale.obj"
|
||||
-@erase "$(OUTDIR)\$(OUTFILENAME).lib"
|
||||
@ -159,6 +160,7 @@ LIB32_OBJS= \
|
||||
"$(INTDIR)\dirmod.obj" \
|
||||
"$(INTDIR)\pgsleep.obj" \
|
||||
"$(INTDIR)\open.obj" \
|
||||
"$(INTDIR)\system.obj" \
|
||||
"$(INTDIR)\win32error.obj" \
|
||||
"$(INTDIR)\win32setlocale.obj" \
|
||||
"$(INTDIR)\pthread-win32.obj"
|
||||
@ -335,6 +337,11 @@ LINK32_OBJS= \
|
||||
$(CPP_PROJ) /I"." ..\..\port\open.c
|
||||
<<
|
||||
|
||||
"$(INTDIR)\system.obj" : ..\..\port\system.c
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) /I"." ..\..\port\system.c
|
||||
<<
|
||||
|
||||
"$(INTDIR)\win32error.obj" : ..\..\port\win32error.c
|
||||
$(CPP) @<<
|
||||
$(CPP_PROJ) /I"." ..\..\port\win32error.c
|
||||
|
Reference in New Issue
Block a user