From 91feaaa9f9b3b1183543dba547d7643bf2526cbc Mon Sep 17 00:00:00 2001 From: Ross Mohn Date: Tue, 23 Jun 2015 13:04:16 +0200 Subject: [PATCH] Fix strange behavior with abduco -A Here are the steps: 1) Run 'abduco -A foo ping suckless.org' 2) Press 'CTRL+\' to detach 3) Run 'abduco -A foo' to reattach 4) Press 'CTRL+\' and it flashes the screen but does not detach 5) Press 'CTRL+\' a second time and it detaches this time Here's what the output looks like: $ abduco -A foo ping suckless.org abduco: foo: detached $ abduco -A foo abduco: foo: detached abduco: foo: detached $ Also, oddly, I am only seeing this behavior on my Ubuntu Linux host, not my AIX hosts. --- abduco.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/abduco.c b/abduco.c index 5c4d174..9836149 100644 --- a/abduco.c +++ b/abduco.c @@ -633,9 +633,10 @@ int main(int argc, char *argv[]) { die("attach-session"); break; case 'A': - if (session_alive(server.session_name) && !attach_session(server.session_name, true)) - die("attach-session"); - if (!attach_session(server.session_name, !force)) { + if (session_alive(server.session_name)) { + if (!attach_session(server.session_name, true)) + die("attach-session"); + } else if (!attach_session(server.session_name, !force)) { force = false; action = 'c'; goto redo;