]> git.ozlabs.org Git - petitboot/blobdiff - ui/common/discover-client.c
Fix seg fault on ps3 flash error
[petitboot] / ui / common / discover-client.c
index b1ef440a9127e927f3e6456fb25688248f05ecc7..5b42b6c4e0aa7662eb022b93a6952e6572e29a65 100644 (file)
@@ -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);