abduco

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 4ab9cb7fcc83498a19f1c554ce45d62a3ee15e41
parent 64713a32191781c104bed7fdc1b24a6e460e20be
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 30 Jul 2015 12:20:41 +0200

Fix display of status flags in session list

Diffstat:
abduco.c | 21+++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/abduco.c b/abduco.c @@ -546,25 +546,14 @@ static int list_session(void) { char status = ' '; char *local = strstr(namelist[n]->d_name, server.host); if (local) { - char *name = strdup(namelist[n]->d_name); *local = '\0'; /* truncate hostname if we are local */ - if (session_alive(namelist[n]->d_name)) - status = '*'; - else if (session_exists(namelist[n]->d_name)) - status = '+'; - /* check if the socket is still valid, session_{alive,exists} - * might have deleted it */ - if (name && stat(name, &sb) == -1) { - free(name); + if (!session_exists(namelist[n]->d_name)) continue; - } - free(name); - } else { - if (sb.st_mode & S_IXUSR) - status = '*'; - else if (sb.st_mode & S_IXGRP) - status = '+'; } + if (sb.st_mode & S_IXUSR) + status = '*'; + else if (sb.st_mode & S_IXGRP) + status = '+'; printf("%c %s\t%s\n", status, buf, namelist[n]->d_name); } free(namelist[n]);