summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. Tilmann Bubeck <tilmann@bubecks.de>2020-08-20 20:28:52 +0200
committerDr. Tilmann Bubeck <tilmann@bubecks.de>2020-08-20 20:28:52 +0200
commit18a3c3a7672ff5d65bf0b79b89464eac7540b95b (patch)
tree81f915b26682cb937f9ac596e1604270476a38bf
parentaaf037ec5c576e46318935feaf6e2b7407ff11a0 (diff)
Additionally check socket file with S_ISSOCKHEADmaster
This fixes bug https://bugzilla.redhat.com/show_bug.cgi?id=1870201
-rw-r--r--gethost.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gethost.c b/gethost.c
index 8cb58c5..c353a9a 100644
--- a/gethost.c
+++ b/gethost.c
@@ -202,14 +202,14 @@ struct addrlist *get_address_info (
strncpy(path, fulldpyname, sizeof(path));
path[sizeof(path) - 1] = '\0';
#endif
- if (0 == stat(path, &sbuf)) {
+ if (0 == stat(path, &sbuf) && S_ISSOCK(sbuf.st_mode) ) {
is_path_to_socket = 1;
} 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)) {
is_path_to_socket = 1;
}
}