Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a136915

Browse files
committed
bug fix for postgre's --os-shell (when there was an error in command executed and/or no output chars, garbled output was returned)
1 parent 694a65f commit a136915

4 files changed

Lines changed: 4 additions & 0 deletions

File tree

extra/udfhack/linux/32/lib_postgresqludf_sys/lib_postgresqludf_sys.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ extern DLLIMPORT Datum sys_eval(PG_FUNCTION_ARGS) {
122122
result = (char *)malloc(1);
123123
outlen = 0;
124124

125+
result[0] = (char)0;
126+
125127
pipe = popen(command, "r");
126128

127129
while (fgets(line, sizeof(line), pipe) != NULL) {

extra/udfhack/linux/64/lib_postgresqludf_sys/lib_postgresqludf_sys.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ extern DLLIMPORT Datum sys_eval(PG_FUNCTION_ARGS) {
122122
result = (char *)malloc(1);
123123
outlen = 0;
124124

125+
result[0] = (char)0;
126+
125127
pipe = popen(command, "r");
126128

127129
while (fgets(line, sizeof(line), pipe) != NULL) {
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)