Skip to content

Commit ac7774d

Browse files
committed
libsubprocess: remove exec_failed_errno
Problem: The internal variable exec_failed_errno was used when libsubprocess tried to differentiate between errnos from different internal executions. Most notably exec_failed_errno was associated with the FLUX_SUBPROCESS_EXEC_FAILED state. However, the state FLUX_SUBPROCESS_EXEC_FAILED has been refactored away. So the internal variable exec_failed_errno has no purpose. Remove use of the variable.
1 parent eb47995 commit ac7774d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/common/libsubprocess/fork.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,12 @@ static int local_release_child (flux_subprocess_t *p)
248248

249249
static int local_exec (flux_subprocess_t *p)
250250
{
251-
if ((p->exec_failed_errno = local_release_child (p)) != 0) {
251+
int ret;
252+
/* N.B. We don't set p->failed_errno here, if locally launched via
253+
* flux_local_exec(), will return -1 and errno to caller. If
254+
* called via server, p->failed_errno will be set by remote
255+
* handler. */
256+
if ((ret = local_release_child (p)) != 0) {
252257
/*
253258
* Reap child immediately. Expectation from caller is that
254259
* failure to exec will not require subsequent reaping of
@@ -260,7 +265,7 @@ static int local_exec (flux_subprocess_t *p)
260265
return -1;
261266
p->status = status;
262267

263-
errno = p->exec_failed_errno;
268+
errno = ret;
264269
return -1;
265270
}
266271
return 0;

src/common/libsubprocess/subprocess_private.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ struct flux_subprocess {
8484
int channels_eof_sent; /* counter to avoid loop checks */
8585

8686
int status; /* Raw status from waitpid(2), valid if exited */
87-
int exec_failed_errno; /* Holds errno from exec(2) if exec() failed */
8887

8988
flux_subprocess_state_t state;
9089
flux_subprocess_state_t state_reported; /* for on_state_change */

0 commit comments

Comments
 (0)