[sheepdog] [PATCH] dog/farm: fix closing negative fd

Liu Yuan namei.unix at gmail.com
Fri Jun 20 07:11:51 CEST 2014


On Fri, Jun 20, 2014 at 01:59:18PM +0900, Hitoshi Mitake wrote:
> At Wed, 18 Jun 2014 18:17:57 +0800,
> Ruoyu wrote:
> > 
> > When executing dog cluster snapshot command, valgrind report
> > "Warning: invalid file descriptor -1 in syscall close()".
> > 
> > This patch fix the problem.
> > 
> > Signed-off-by: Ruoyu <liangry at ucweb.com>
> > ---
> >  dog/farm/snap.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> Looks good to me.
> Reviewed-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> 
> Thanks,
> Hitoshi
> 
> > 
> > diff --git a/dog/farm/snap.c b/dog/farm/snap.c
> > index ff03047..9040369 100644
> > --- a/dog/farm/snap.c
> > +++ b/dog/farm/snap.c
> > @@ -36,10 +36,11 @@ int snap_init(const char *farm_dir)
> >  
> >  	fd = open(snap_log_path, O_CREAT | O_EXCL, 0666);
> >  	if (fd < 0) {
> > -		if (errno != EEXIST) {
> > +		if (errno != EEXIST)
> >  			sd_err("%m");
> > -			goto out;
> > -		}
> > +		else
> > +			ret = 0;
> > +		goto out;
> >  	}
> >  
> >  	ret = 0;
> > -- 
> > 1.8.3.2
> > 
> > 
> > -- 
> > sheepdog mailing list
> > sheepdog at lists.wpkg.org
> > http://lists.wpkg.org/mailman/listinfo/sheepdog
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog

Applied thanks

Yuan



More information about the sheepdog mailing list