[sheepdog] [PATCH v2 3/4] util: add a new API atomic_create_and_write()

Liu Yuan namei.unix at gmail.com
Wed Apr 17 10:03:03 CEST 2013


On 04/17/2013 03:58 PM, Hitoshi Mitake wrote:
> +	fd = open(tmp_path, O_WRONLY | O_CREAT | O_SYNC, sd_def_fmode);
> +	if (fd < 0) {
> +		sd_eprintf("failed to temporal file for config, %m");
> +		ret = -1;
> +		goto end;
> +	}
> +
> +	ret = xwrite(fd, buf, len);
> +	if (ret != len) {
> +		sd_eprintf("failed to write config data, %m");
> +		ret = -1;
> +		goto close_fd;

This is a generic API, so config should be avoided :)

Thanks,
Yuan



More information about the sheepdog mailing list