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

Skip to content

Commit d02fc64

Browse files
knizhnikgsmolk
authored andcommitted
Terminate ssh error by zero character
1 parent b7d5d6c commit d02fc64

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/utils/file.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,13 @@ void fio_error(int rc, int size, char const* file, int line)
5555
}
5656
else
5757
{
58-
char buf[PRINTF_BUF_SIZE];
59-
int err_size = read(fio_stderr, buf, sizeof(buf));
58+
char buf[PRINTF_BUF_SIZE+1];
59+
int err_size = read(fio_stderr, buf, PRINTF_BUF_SIZE);
6060
if (err_size > 0)
61+
{
62+
buf[err_size] = '\0';
6163
elog(ERROR, "Agent error: %s", buf);
64+
}
6265
else
6366
elog(ERROR, "Communication error: %s", rc >= 0 ? "end of data" : strerror(errno));
6467
}

0 commit comments

Comments
 (0)