From ce87ae39d5ab28733b4125a09d0a643d1581b1c8 Mon Sep 17 00:00:00 2001 From: Larry Doolittle Date: Sat, 16 Apr 2022 15:28:31 -0700 Subject: [PATCH] Expand checks of socket file with S_ISSOCK Extend work done in commit 18a3c3a to earlier in the socket detection process Fixes issue #6. --- parsedpy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parsedpy.c b/parsedpy.c index b5ff2f4..5744a4b 100644 --- a/parsedpy.c +++ b/parsedpy.c @@ -175,14 +175,14 @@ parse_displayname (const char *displayname, strncpy(path, displayname, sizeof(path) - 1); path[sizeof(path) - 1] = '\0'; #endif - if (0 == stat(path, &sbuf)) { + if (0 == stat(path, &sbuf) && S_ISSOCK(sbuf.st_mode)) { family = FamilyLocal; } else { char *dot = strrchr(path, '.'); if (dot) { *dot = '\0'; /* screen = atoi(dot + 1); */ - if (0 == stat(path, &sbuf)) { + if (0 == stat(path, &sbuf) && S_ISSOCK(sbuf.st_mode)) { family = FamilyLocal; } } -- GitLab