[sheepdog] [PATCH] dog: allow snapshot tags which begin with decimal number

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Feb 3 09:43:44 CET 2014


At Mon,  3 Feb 2014 10:11:51 +0900,
Hitoshi Mitake wrote:
> 
> Current dog command doesn't accept snapshot tags which begin with
> decimal number, e.g. 123abc. This behavior comes from invalid usage of
> strtol(). This patch fixes this problem.
> 
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
>  dog/vdi.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Sorry, please ignore this one. I found the "-F" option of vdi
subcommands has a same problem. I'll send v2 later.

Thanks,
Hitoshi

> 
> diff --git a/dog/vdi.c b/dog/vdi.c
> index 52c25a8..4f62289 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -2479,7 +2479,7 @@ static int vdi_parser(int ch, const char *opt)
>  		break;
>  	case 's':
>  		vdi_cmd_data.snapshot_id = strtol(opt, &p, 10);
> -		if (opt == p) {
> +		if (opt == p || *p != '\0') {
>  			vdi_cmd_data.snapshot_id = 0;
>  			pstrcpy(vdi_cmd_data.snapshot_tag,
>  				sizeof(vdi_cmd_data.snapshot_tag), opt);
> -- 
> 1.7.10.4
> 



More information about the sheepdog mailing list