Return build_cmd() success via a boolean
For consistency with other functions in the codebase.
This commit is contained in:
parent
77e96d745b
commit
710e80aa0d
1 changed files with 4 additions and 4 deletions
|
@ -6,7 +6,7 @@
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/str_util.h"
|
#include "util/str_util.h"
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
build_cmd(char *cmd, size_t len, const char *const argv[]) {
|
build_cmd(char *cmd, size_t len, const char *const argv[]) {
|
||||||
// Windows command-line parsing is WTF:
|
// Windows command-line parsing is WTF:
|
||||||
// <http://daviddeley.com/autohotkey/parameters/parameters.htm#WINPASS>
|
// <http://daviddeley.com/autohotkey/parameters/parameters.htm#WINPASS>
|
||||||
|
@ -15,9 +15,9 @@ build_cmd(char *cmd, size_t len, const char *const argv[]) {
|
||||||
size_t ret = xstrjoin(cmd, argv, ' ', len);
|
size_t ret = xstrjoin(cmd, argv, ' ', len);
|
||||||
if (ret >= len) {
|
if (ret >= len) {
|
||||||
LOGE("Command too long (%" PRIsizet " chars)", len - 1);
|
LOGE("Command too long (%" PRIsizet " chars)", len - 1);
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum process_result
|
enum process_result
|
||||||
|
@ -28,7 +28,7 @@ process_execute(const char *const argv[], HANDLE *handle) {
|
||||||
si.cb = sizeof(si);
|
si.cb = sizeof(si);
|
||||||
|
|
||||||
char cmd[256];
|
char cmd[256];
|
||||||
if (build_cmd(cmd, sizeof(cmd), argv)) {
|
if (!build_cmd(cmd, sizeof(cmd), argv)) {
|
||||||
*handle = NULL;
|
*handle = NULL;
|
||||||
return PROCESS_ERROR_GENERIC;
|
return PROCESS_ERROR_GENERIC;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue