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

Hitoshi Mitake mitake.hitoshi at gmail.com
Tue Apr 16 08:42:41 CEST 2013


At Tue, 16 Apr 2013 11:17:04 +0800,
Liu Yuan wrote:
> 
> 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, I'll use access in v2.
Hitoshi



More information about the sheepdog mailing list