Re: [PATCH 1/8] Parse config_version as 64-bit uint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ACK

On 10/1/2012 4:21 PM, Jan Friesse wrote:
> Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
> ---
>  exec/coroparse.c |   31 +++++++++++++++++++++++++++++++
>  1 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/exec/coroparse.c b/exec/coroparse.c
> index 3e686e8..100b717 100644
> --- a/exec/coroparse.c
> +++ b/exec/coroparse.c
> @@ -357,6 +357,29 @@ static int safe_atoi(const char *str, int *res)
>  	return (0);
>  }
>  
> +static int str_to_ull(const char *str, unsigned long long int *res)
> +{
> +	unsigned long long int val;
> +	char *endptr;
> +
> +	errno = 0;
> +
> +	val = strtoull(str, &endptr, 10);
> +	if (errno == ERANGE) {
> +		return (-1);
> +	}
> +
> +	if (endptr == str) {
> +		return (-1);
> +	}
> +
> +	if (*endptr != '\0') {
> +		return (-1);
> +	}
> +
> +	*res = val;
> +	return (0);
> +}
>  
>  static int main_config_parser_cb(const char *path,
>  			char *key,
> @@ -366,6 +389,7 @@ static int main_config_parser_cb(const char *path,
>  			void *user_data)
>  {
>  	int i;
> +	unsigned long long int ull;
>  	int add_as_string;
>  	char key_name[ICMAP_KEYNAME_MAXLEN];
>  	static char formated_err[256];
> @@ -469,6 +493,13 @@ static int main_config_parser_cb(const char *path,
>  				icmap_set_uint32(path, i);
>  				add_as_string = 0;
>  			}
> +			if (strcmp(path, "totem.config_version") == 0) {
> +				if (str_to_ull(value, &ull) != 0) {
> +					goto atoi_error;
> +				}
> +				icmap_set_uint64(path, ull);
> +				add_as_string = 0;
> +			}
>  			if (strcmp(path, "totem.crypto_type") == 0) {
>  				if ((strcmp(value, "nss") != 0) &&
>  				    (strcmp(value, "aes256") != 0)) {
> 

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux