aboutsummaryrefslogtreecommitdiff
path: root/slave.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-02-22 08:28:53 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-02-22 08:28:53 +0000
commit3d7207f9c56808ce623c8cd6ba003ec3e7a0a556 (patch)
treec66fc8a2104038d8af6fb77fa1bd4cc51ff43d8e /slave.c
parentMerge branch 'osc8' (diff)
parenterrno: don’t use ‘_errno’ as a variable name; _ are reserved for use as identifiers (diff)
Merge branch 'rename-_errno'
Diffstat (limited to 'slave.c')
-rw-r--r--slave.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/slave.c b/slave.c
index ed36a0b1..0740d6ae 100644
--- a/slave.c
+++ b/slave.c
@@ -268,20 +268,20 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
close(fork_pipe[0]); /* Close read end */
if (chdir(cwd) < 0) {
- const int _errno = errno;
+ const int errno_copy = errno;
LOG_ERRNO("failed to change working directory");
- (void)!write(fork_pipe[1], &_errno, sizeof(_errno));
- _exit(_errno);
+ (void)!write(fork_pipe[1], &errno_copy, sizeof(errno_copy));
+ _exit(errno_copy);
}
/* Restore signal mask */
sigset_t mask;
sigemptyset(&mask);
if (sigprocmask(SIG_SETMASK, &mask, NULL) < 0) {
- const int _errno = errno;
+ const int errno_copy = errno;
LOG_ERRNO_P(errno, "failed to restore signals");
- (void)!write(fork_pipe[1], &_errno, sizeof(_errno));
- _exit(_errno);
+ (void)!write(fork_pipe[1], &errno_copy, sizeof(errno_copy));
+ _exit(errno_copy);
}
setenv("TERM", term_env, 1);
@@ -319,18 +319,18 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
close(fork_pipe[1]); /* Close write end */
LOG_DBG("slave has PID %d", pid);
- int _errno;
- static_assert(sizeof(errno) == sizeof(_errno), "errno size mismatch");
+ int errno_copy;
+ static_assert(sizeof(errno) == sizeof(errno_copy), "errno size mismatch");
- ssize_t ret = read(fork_pipe[0], &_errno, sizeof(_errno));
+ ssize_t ret = read(fork_pipe[0], &errno_copy, sizeof(errno_copy));
close(fork_pipe[0]);
if (ret < 0) {
LOG_ERRNO("failed to read from pipe");
return -1;
- } else if (ret == sizeof(_errno)) {
+ } else if (ret == sizeof(errno_copy)) {
LOG_ERRNO_P(
- _errno, "%s: failed to execute",
+ errno_copy, "%s: failed to execute",
argc == 0 ? conf_shell : argv[0]);
return -1;
} else