dir = opendir(SOCK_PATH);
if (!dir)
- return errno == ENOENT ? 0 : errno;
+ return errno == ENOENT ? 0 : -errno;
while ((ent = readdir(dir))) {
len = strlen(ent->d_name);
if (len <= strlen(SOCK_SUFFIX))
cleanup:
errno = -ret;
if (errno) {
- perror("Error when trying to get a list of WireGuard interfaces");
free(buffer.buffer);
return NULL;
}
device->name[IFNAMSIZ - 1] = '\0';
if (ipc_set_device(device) != 0) {
- perror("Unable to set device");
+ perror("Unable to modify interface");
goto cleanup;
}
device->name[IFNAMSIZ - 1] = '\0';
if (ipc_set_device(device) != 0) {
- perror("Unable to set device");
+ perror("Unable to modify interface");
goto cleanup;
}
char *interfaces = ipc_list_devices(), *interface;
if (!interfaces) {
- perror("Unable to get devices");
+ perror("Unable to list interfaces");
return 1;
}
interface = interfaces;
struct wgdevice *device = NULL;
if (ipc_get_device(&device, interface) < 0) {
- perror("Unable to get device");
+ perror("Unable to access interface");
continue;
}
if (argc == 3) {
}
interfaces = ipc_list_devices();
if (!interfaces) {
- perror("Unable to get devices");
+ perror("Unable to list interfaces");
return 1;
}
interface = interfaces;
struct wgdevice *device = NULL;
if (ipc_get_device(&device, argv[1]) < 0) {
- perror("Unable to get device");
+ perror("Unable to access interface");
return 1;
}
if (argc == 3) {
}
if (ipc_get_device(&device, argv[1])) {
- perror("Unable to get device");
+ perror("Unable to access interface");
goto cleanup;
}