[sheepdog] [PATCH V2]Replace malloc with xmalloc for collie

Hitoshi Mitake mitake.hitoshi at gmail.com
Thu Feb 21 09:59:39 CET 2013


At Thu, 21 Feb 2013 12:57:00 +0800,
harryxiyou at gmail.com wrote:
> 
> v2: Merge Hitoshi Mitake and Morita's suggestions
> 	1, Replace malloc with xmalloc
> 	2, Catch SIGABRT for xmalloc
> 
> Signed-off-by: Harry Wei <harryxiyou at gmail.com>
> Subject: Replace malloc with xmalloc for collie

You don't have to write subject here.

> 
> ---

The above description of difference between each versions (v2:
Merge...) should be written here.

You can mimick a style of patch from other patches posted to this
mailing list.

>  collie/collie.c |   22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 

> +void crash_handler(int signo)
> +{
> +	if (signo == SIGABRT)
> +		fprintf(stderr, "collie abort.\n");
> +	else
> +		fprintf(stderr, "collie got unexpected signal %d.\n", signo);
> +
> +	exit(1);
> +}

This crash_handler() should be declared as a static function. It
doesn't have to be seem from other source files.

> +
>  int main(int argc, char **argv)
>  {
>  	int ch, longindex, ret;
> @@ -321,8 +332,17 @@ int main(int argc, char **argv)
>  	const char *short_options;
>  	char *p;
>  	const struct sd_option *sd_opts;
> +	struct sigaction sa_old;
> +	struct sigaction sa_new;
>  
>  	init_commands(&commands);
> +
> +	/* check xmalloc SIGABRT signal in init_commands func */

xmalloc() is not a single source of SIGABRT. This comment is
confusing.

Thanks,
Hitoshi



More information about the sheepdog mailing list