[lxc-devel] [PATCH] lxc-clone: proper type for getopt_long result

Stéphane Graber stgraber at ubuntu.com
Mon Dec 9 19:57:10 UTC 2013


On Mon, Dec 09, 2013 at 04:39:46PM +0200, Bogdan Purcareata wrote:
> While char is a signed type and should have no trouble
> storing a "-1" value, getopt_long() will return a value of 255
> instead of -1. This has been noticed on powerpc; there's also
> some upstream talk about it at [1].
> 
> Change variable type from char to int, since it's also the
> documented use.
> 
> [1] http://stackoverflow.com/questions/17070958/c-why-does-getopt-return-255-on-linux
> 
> Signed-off-by: Bogdan Purcareata <bogdan.purcareata at freescale.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/lxc_clone.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lxc/lxc_clone.c b/src/lxc/lxc_clone.c
> index 4639a90..88a768d 100644
> --- a/src/lxc/lxc_clone.c
> +++ b/src/lxc/lxc_clone.c
> @@ -102,7 +102,7 @@ int main(int argc, char *argv[])
>  	char *bdevtype = NULL, *lxcpath = NULL, *newpath = NULL, *fstype = NULL;
>  	char *orig = NULL, *new = NULL, *vgname = NULL;
>  	char **args = NULL;
> -	char c;
> +	int c;
>  
>  	if (argc < 3)
>  		usage(argv[0]);
> -- 
> 1.7.11.7
> 
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20131209/60b4d187/attachment.pgp>


More information about the lxc-devel mailing list