diff options
author | David Timber <mieabby@gmail.com> | 2020-09-22 17:05:06 +0930 |
---|---|---|
committer | David Timber <mieabby@gmail.com> | 2020-09-22 17:05:06 +0930 |
commit | c1ae3eef633237525443d48622bb6f633392d2f6 (patch) | |
tree | 4e3c3aaf481a6c67fc830291272e6746f2ecf725 /src/bne.c | |
parent | a90806846e881c0894726e89e1584540457a168d (diff) |
* Add proone exit codes as macro defs
* Lock file acquisition failure is not an error
Diffstat (limited to 'src/bne.c')
-rw-r--r-- | src/bne.c | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -1202,10 +1202,17 @@ static bool bne_sh_setup ( if (PRNE_DEBUG && PRNE_VERBOSE >= PRNE_VL_DBG0) { const char *arch_str = prne_arch_tostr(ctx->result.arch); - prne_dbgpf( - "bne@%"PRIxPTR"\t: arch: %s\n", - (uintptr_t)ctx, - arch_str == NULL ? "?" : arch_str); + if (arch_str == NULL) { + prne_dbgpf( + "bne@%"PRIxPTR"\t: arch detection failed\n", + (uintptr_t)ctx); + } + else { + prne_dbgpf( + "bne@%"PRIxPTR"\t: arch: %s\n", + (uintptr_t)ctx, + arch_str); + } } ret = ctx->result.arch != PRNE_ARCH_NONE; @@ -1559,7 +1566,7 @@ static bool bne_sh_run_exec ( char *cmd; bne_sh_parser_t parser; int ec = -1; - bool ret; + bool ret = false; bne_init_sh_parser(&parser); parser.ctx = &ec; @@ -1571,7 +1578,17 @@ static bool bne_sh_run_exec ( return false; } - ret = bne_sh_runcmd_line(s_ctx, &parser, cmd) && ec == 0; + if (bne_sh_runcmd_line(s_ctx, &parser, cmd)) { + switch (ec) { + case PRNE_PROONE_EC_OK: + // successful launch + case PRNE_PROONE_EC_LOCK: + // failed to acquire lock + // assume that a process is already running + ret = true; + break; + } + } prne_free(cmd); return ret; |