summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannesweisbach <hannesweisbach@users.noreply.github.com>2019-10-29 08:35:24 +0100
committerGitHub <noreply@github.com>2019-10-29 08:35:24 +0100
commit321d0c079230cbd447a8456db24ecd7eb2fd1be4 (patch)
tree930b6428732d3ba5bc0ab1743e798676ae03ce7d
parentc656b9056e45f9acd1d374a85c5becf7cc6a00ca (diff)
downloadfio-321d0c079230cbd447a8456db24ecd7eb2fd1be4.tar.gz
fio-321d0c079230cbd447a8456db24ecd7eb2fd1be4.tar.bz2
Fix output redirection of exec_prerun/_postrun
The previous version used the bashism "&>" to redirect stdout and stderr of the prerun/postrun commands to an output file. Since system() executes the command using "/bin/sh sh -c …". If /bin/sh is not bash, this wont work. Use the "posixly-correct" way of redirecting stdout to the output file and then redirect stderr to stdout. Signed-off-by: Hannes Weisbach <hannes.weisbach@gmail.com>
-rw-r--r--backend.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/backend.c b/backend.c
index fe868271..54273f8d 100644
--- a/backend.c
+++ b/backend.c
@@ -1469,12 +1469,12 @@ static bool keep_running(struct thread_data *td)
static int exec_string(struct thread_options *o, const char *string, const char *mode)
{
- size_t newlen = strlen(string) + strlen(o->name) + strlen(mode) + 9 + 1;
+ size_t newlen = strlen(string) + strlen(o->name) + strlen(mode) + 13 + 1;
int ret;
char *str;
str = malloc(newlen);
- sprintf(str, "%s &> %s.%s.txt", string, o->name, mode);
+ sprintf(str, "%s > %s.%s.txt 2>&1", string, o->name, mode);
log_info("%s : Saving output of %s in %s.%s.txt\n",o->name, mode, o->name, mode);
ret = system(str);