At Fri, 29 Mar 2013 13:49:42 +0800,
Liu Yuan wrote:
> 
> +
> +static int do_plug_unplug(char *disks, bool plug)
> +{
> +     struct sd_req hdr;
> +     struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
> +     int fd, ret;
> +
> +     fd = connect_to(sdhost, sdport);
> +     if (fd < 0) {
> +             fprintf(stderr, "Failed to connect %s:%d\n", sdhost, sdport);
> +             return EXIT_FAILURE;
> +     }
> +
> +     if (plug)
> +             sd_init_req(&hdr, SD_OP_MD_PLUG);
> +     else
> +             sd_init_req(&hdr, SD_OP_MD_UNPLUG);
> +     hdr.flags = SD_FLAG_CMD_WRITE;
> +     hdr.data_length = strlen(disks);

Should be strlen(disks) + 1 to include the terminating '\0' character.

Thanks,

Kazutaka
-- 
sheepdog mailing list
sheepdog@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to