diff --git a/include/uniproc.h b/include/uniproc.h index ab3a58e..eb30910 100644 --- a/include/uniproc.h +++ b/include/uniproc.h @@ -4,12 +4,12 @@ #include #include typedef struct { - FILE* in = NULL; - FILE* out= NULL; - FILE* err= NULL; + FILE* in; + FILE* out; + FILE* err; // OS-dependent handle to the process - uint32_t _proc_hdl = -1; + uint32_t _proc_hdl; } uniproc_process; diff --git a/src/uniproc_win64.c b/src/uniproc_win64.c index 5eb5f68..767a82a 100644 --- a/src/uniproc_win64.c +++ b/src/uniproc_win64.c @@ -44,6 +44,7 @@ uniproc_process uniproc_create_process(const char* cmd, const size_t num_args, c for (size_t i = 0; i < num_args; ++i) cmd_len += strlen(argv[i]) + 1; char* p_cmd = malloc((cmd_len+1) * sizeof(char)); + p_cmd[x] = ' '; memcpy(p_cmd, cmd, x * sizeof(char)); x += 1; // Account for space after cmd for (size_t i = 0; i < num_args; ++i) @@ -51,7 +52,7 @@ uniproc_process uniproc_create_process(const char* cmd, const size_t num_args, c size_t arglen = strlen(argv[i]); memcpy(p_cmd + x, argv[i], arglen); p_cmd[x + arglen] = ' '; - x += arglen + 1 + x += arglen + 1; } p_cmd[cmd_len] = '\0';