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