]> git.ozlabs.org Git - petitboot/blobdiff - ui/common/discover-client.c
Add UI option --dry-run
[petitboot] / ui / common / discover-client.c
index b1ef440a9127e927f3e6456fb25688248f05ecc7..cd9f63a9f68f584bcc5b3f26976fd6d73269ad11 100644 (file)
@@ -12,7 +12,7 @@
 #include <talloc/talloc.h>
 #include <log/log.h>
 
-#include "ui/common/discover-client.h"
+#include "discover-client.h"
 #include "pb-protocol/pb-protocol.h"
 
 struct discover_client {
@@ -46,7 +46,7 @@ struct discover_client* discover_client_init(
        client->ops.cb_arg = cb_arg;
 
        client->fd = socket(AF_UNIX, SOCK_STREAM, 0);
-       if (!client->fd < 0) {
+       if (client->fd < 0) {
                pb_log("%s: socket: %s\n", __func__, strerror(errno));
                goto out_err;
        }
@@ -111,7 +111,7 @@ static void device_remove(struct discover_client *client, const char *id)
        /* remove the device from the client's device array */
        client->n_devices--;
        memmove(&client->devices[i], &client->devices[i+1],
-                       client->n_devices - i);
+                       (client->n_devices - i) * sizeof(client->devices[0]));
        client->devices = talloc_realloc(client, client->devices,
                        struct device *, client->n_devices);