|
@@ -40,25 +40,24 @@
|
|
|
#include <misc/cmdline.h>
|
|
#include <misc/cmdline.h>
|
|
|
#include <misc/balloc.h>
|
|
#include <misc/balloc.h>
|
|
|
|
|
|
|
|
-#define STDBUF_EXEC "/usr/bin/stdbuf"
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* Builds the initial part of command line for calling a program via stdbuf
|
|
* Builds the initial part of command line for calling a program via stdbuf
|
|
|
* with standard output buffering set to line-buffered.
|
|
* with standard output buffering set to line-buffered.
|
|
|
*
|
|
*
|
|
|
* @param out {@link CmdLine} to append the result to. Note than on failure, only
|
|
* @param out {@link CmdLine} to append the result to. Note than on failure, only
|
|
|
* some part of the cmdline may have been appended.
|
|
* some part of the cmdline may have been appended.
|
|
|
|
|
+ * @param stdbuf_exec full path to stdbuf executable
|
|
|
* @param exec path to the executable. Must not contain nulls.
|
|
* @param exec path to the executable. Must not contain nulls.
|
|
|
* @param exec_len number of characters in exec
|
|
* @param exec_len number of characters in exec
|
|
|
* @return 1 on success, 0 on failure
|
|
* @return 1 on success, 0 on failure
|
|
|
*/
|
|
*/
|
|
|
-static int build_stdbuf_cmdline (CmdLine *out, const char *exec, size_t exec_len) WARN_UNUSED;
|
|
|
|
|
|
|
+static int build_stdbuf_cmdline (CmdLine *out, const char *stdbuf_exec, const char *exec, size_t exec_len) WARN_UNUSED;
|
|
|
|
|
|
|
|
-int build_stdbuf_cmdline (CmdLine *out, const char *exec, size_t exec_len)
|
|
|
|
|
|
|
+int build_stdbuf_cmdline (CmdLine *out, const char *stdbuf_exec, const char *exec, size_t exec_len)
|
|
|
{
|
|
{
|
|
|
ASSERT(!memchr(exec, '\0', exec_len))
|
|
ASSERT(!memchr(exec, '\0', exec_len))
|
|
|
|
|
|
|
|
- if (!CmdLine_AppendMulti(out, 3, STDBUF_EXEC, "-o", "L")) {
|
|
|
|
|
|
|
+ if (!CmdLine_AppendMulti(out, 3, stdbuf_exec, "-o", "L")) {
|
|
|
goto fail1;
|
|
goto fail1;
|
|
|
}
|
|
}
|
|
|
|
|
|