[sheepdog] [PATCH 2/2] sheep: implement atomic create and write mechanism for config

Liu Yuan namei.unix at gmail.com
Tue Apr 16 05:17:04 CEST 2013


On 04/15/2013 11:16 PM, Hitoshi Mitake wrote:
> +static void check_tmp_config(void)
> +{
> +	int fd;
> +
> +	fd = open(tmp_config_path, O_RDONLY);
> +	if (fd < 0 && errno == ENOENT)
> +		return;
> +

FD leak.

> +	sd_iprintf("temporal file for config exists");
> +	unlink(tmp_config_path);

It is better to use 'access(2)'.

Thanks,
Yuan



More information about the sheepdog mailing list