Commit 18a3c3a7 authored by Tilmann Bubeck's avatar Tilmann Bubeck
Browse files

Additionally check socket file with S_ISSOCK

This fixes bug https://bugzilla.redhat.com/show_bug.cgi?id=1870201
parent aaf037ec
...@@ -202,14 +202,14 @@ struct addrlist *get_address_info ( ...@@ -202,14 +202,14 @@ struct addrlist *get_address_info (
strncpy(path, fulldpyname, sizeof(path)); strncpy(path, fulldpyname, sizeof(path));
path[sizeof(path) - 1] = '\0'; path[sizeof(path) - 1] = '\0';
#endif #endif
if (0 == stat(path, &sbuf)) { if (0 == stat(path, &sbuf) && S_ISSOCK(sbuf.st_mode) ) {
is_path_to_socket = 1; is_path_to_socket = 1;
} else { } else {
char *dot = strrchr(path, '.'); char *dot = strrchr(path, '.');
if (dot) { if (dot) {
*dot = '\0'; *dot = '\0';
/* screen = atoi(dot + 1); */ /* screen = atoi(dot + 1); */
if (0 == stat(path, &sbuf)) { if (0 == stat(path, &sbuf) && S_ISSOCK(sbuf.st_mode)) {
is_path_to_socket = 1; is_path_to_socket = 1;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment