| 180 | } |
| 181 | |
| 182 | static int rpc_open(struct plugin *plugin) |
| 183 | { |
| 184 | struct sockaddr_un addr; |
| 185 | int fd = socket(AF_UNIX, SOCK_STREAM, 0); |
| 186 | |
| 187 | if (strlen(plugin->rpc_location) + 1 > sizeof(addr.sun_path)) |
| 188 | plugin_err(plugin, "rpc filename '%s' too long", |
| 189 | plugin->rpc_location); |
| 190 | strcpy(addr.sun_path, plugin->rpc_location); |
| 191 | addr.sun_family = AF_UNIX; |
| 192 | |
| 193 | if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) != 0) { |
| 194 | plugin_log(plugin, LOG_UNUSUAL, |
| 195 | "Could not connect to '%s': %s", |
| 196 | plugin->rpc_location, strerror(errno)); |
| 197 | close(fd); |
| 198 | fd = -1; |
| 199 | } |
| 200 | return fd; |
| 201 | } |
| 202 | |
| 203 | static void complain_deprecated(const char *feature, |
| 204 | bool allowing, |
no test coverage detected