diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-09-09 20:39:58 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-09-09 20:39:58 +0000 |
commit | 0734bbc08aa726cc371f8c0bf5e6aadce2825245 (patch) | |
tree | 7b4af9d3333262f96fc95f273bc34ad2d841cfb8 /src/tls | |
parent | d1ec57c644c528b5e7bded2abf56ccddf7452804 (diff) | |
download | s6-networking-0734bbc08aa726cc371f8c0bf5e6aadce2825245.tar.xz |
Fix s6-tlsd fd fux
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/tls')
-rw-r--r-- | src/tls/s6-tlsd.c | 2 | ||||
-rw-r--r-- | src/tls/s6tls_io_spawn.c | 4 | ||||
-rw-r--r-- | src/tls/s6tls_sync_and_exec_app.c | 3 |
3 files changed, 4 insertions, 5 deletions
diff --git a/src/tls/s6-tlsd.c b/src/tls/s6-tlsd.c index 07716ea..a1c19bf 100644 --- a/src/tls/s6-tlsd.c +++ b/src/tls/s6-tlsd.c @@ -17,7 +17,7 @@ int main (int argc, char const *const *argv) unsigned int verbosity = 1 ; unsigned int kimeout = 0 ; unsigned int snilevel = 0 ; - int p[4][2] = { [3] = { [0] = -1, [1] = -1 } } ; + int p[4][2] = { [3] = { [0] = 0, [1] = 1 } } ; uint32_t coptions = 0 ; uint32_t poptions = 1 ; pid_t pid ; diff --git a/src/tls/s6tls_io_spawn.c b/src/tls/s6tls_io_spawn.c index 8e26807..252ddb5 100644 --- a/src/tls/s6tls_io_spawn.c +++ b/src/tls/s6tls_io_spawn.c @@ -11,9 +11,9 @@ pid_t s6tls_io_spawn (char const *const *argv, int const p[4][2]) { [0] = { .type = CSPAWN_FA_CLOSE, .x = { .fd = p[0][1] } }, [1] = { .type = CSPAWN_FA_CLOSE, .x = { .fd = p[1][0] } }, - [2] = { .type = CSPAWN_FA_CLOSE, .x = { .fd = p[2][1] } }, + [2] = { .type = CSPAWN_FA_CLOSE, .x = { .fd = p[2][0] } }, [3] = { .type = CSPAWN_FA_MOVE, .x = { .fd2 = { [0] = 0, [1] = p[3][0] } } }, [4] = { .type = CSPAWN_FA_MOVE, .x = { .fd2 = { [0] = 1, [1] = p[3][1] } } } } ; - return cspawn(argv[0], argv, (char const *const *)environ, 0, fa, p[3][0] >= 0 ? 5 : 3) ; + return cspawn(argv[0], argv, (char const *const *)environ, 0, fa, 5) ; } diff --git a/src/tls/s6tls_sync_and_exec_app.c b/src/tls/s6tls_sync_and_exec_app.c index 3fdd21c..56e8dc1 100644 --- a/src/tls/s6tls_sync_and_exec_app.c +++ b/src/tls/s6tls_sync_and_exec_app.c @@ -16,8 +16,7 @@ void s6tls_sync_and_exec_app (char const *const *argv, int const p[4][2], pid_t close(p[2][1]) ; close(p[1][1]) ; close(p[0][0]) ; - if ((p[3][0] >= 0 && fd_move(p[3][0], p[1][0]) == -1) - || (p[3][1] >= 0 && fd_move(p[3][1], p[0][1]) == -1)) + if (fd_move(p[3][0], p[1][0]) == -1 || fd_move(p[3][1], p[0][1]) == -1) strerr_diefu1sys(111, "move file descriptors") ; r = read(p[2][0], buf, MAXENVSIZE) ; if (r < 0) strerr_diefu1sys(111, "read from handshake notification pipe") ; |