From a136915ab67d63cbf98f6bd135bba72064ff350a Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 5 Jan 2011 14:36:41 +0000 Subject: [PATCH] bug fix for postgre's --os-shell (when there was an error in command executed and/or no output chars, garbled output was returned) --- .../lib_postgresqludf_sys.c | 2 ++ .../lib_postgresqludf_sys.c | 2 ++ .../linux/32/8.3/lib_postgresqludf_sys.so | Bin 5124 -> 5124 bytes .../linux/32/8.4/lib_postgresqludf_sys.so | Bin 5132 -> 5132 bytes 4 files changed, 4 insertions(+) diff --git a/extra/udfhack/linux/32/lib_postgresqludf_sys/lib_postgresqludf_sys.c b/extra/udfhack/linux/32/lib_postgresqludf_sys/lib_postgresqludf_sys.c index afb925ef2..73bbac951 100644 --- a/extra/udfhack/linux/32/lib_postgresqludf_sys/lib_postgresqludf_sys.c +++ b/extra/udfhack/linux/32/lib_postgresqludf_sys/lib_postgresqludf_sys.c @@ -122,6 +122,8 @@ extern DLLIMPORT Datum sys_eval(PG_FUNCTION_ARGS) { result = (char *)malloc(1); outlen = 0; + result[0] = (char)0; + pipe = popen(command, "r"); while (fgets(line, sizeof(line), pipe) != NULL) { diff --git a/extra/udfhack/linux/64/lib_postgresqludf_sys/lib_postgresqludf_sys.c b/extra/udfhack/linux/64/lib_postgresqludf_sys/lib_postgresqludf_sys.c index afb925ef2..73bbac951 100644 --- a/extra/udfhack/linux/64/lib_postgresqludf_sys/lib_postgresqludf_sys.c +++ b/extra/udfhack/linux/64/lib_postgresqludf_sys/lib_postgresqludf_sys.c @@ -122,6 +122,8 @@ extern DLLIMPORT Datum sys_eval(PG_FUNCTION_ARGS) { result = (char *)malloc(1); outlen = 0; + result[0] = (char)0; + pipe = popen(command, "r"); while (fgets(line, sizeof(line), pipe) != NULL) { diff --git a/udf/postgresql/linux/32/8.3/lib_postgresqludf_sys.so b/udf/postgresql/linux/32/8.3/lib_postgresqludf_sys.so index 30f45fd54ee599e3c63cfaeb4f9a5cd19c040208..eb20b094ea800ff0b7fdcc3d4180b3cd722154ba 100755 GIT binary patch delta 203 zcmZqCXwlekhgtLn4+BFm0|SE)12;nkkmdsN&u#w5tj^5nGg*>do$|1W*f9r~g3 uSTBpf4O)4{{R2qe1r!m8TP;Q1+(ji s$$dQ965Xy3nvV!HSTK}ubccR8<|6Q)p}Y1$XYJ(EJc*kPc(1Sl0E;6%LjV8( diff --git a/udf/postgresql/linux/32/8.4/lib_postgresqludf_sys.so b/udf/postgresql/linux/32/8.4/lib_postgresqludf_sys.so index d5c13a404e8a4a6a597000826fb327ff2db1d3f1..9e07a823ff4a214207fe18001adfa3f663a67c26 100755 GIT binary patch delta 203 zcmeCt=+W44hgtLn4+BFm0|SE)12;nkkmdsN&u#w5tj^5nGg*>do$|1W*f9r~g3 uSTBpf4O)4{{R2qe1r!m8TP;Q1+(ji s$$dQ965Xy3nvV!HSTK}ubccR8<|6Q)p}Y1$XYJ(EJc*kPc<-