From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] removefid() question From: "Russ Cox" MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Tue, 30 Jul 2002 07:49:32 -0400 Topicbox-Message-UUID: d594ea78-eaca-11e9-9e20-41e7f4b1d025 > If I call removefid() without holding a reference to the Fid > involved, AFAIK, it should unref the Fid and it should be deleted. > Is this correct? > > My removefid() seems not to do so, so I had to > allocfid() > ... > lookupfid() > removefid() > closefid() // for alloc > closefid() // for remove > > I didn't change removefid() because I'm not sure it's a bug and > I may be missing something. > > What's the right way? Removefid returns the fid it removed, if any. So the right way is allocfid() closefid() // for allocfid ... lookupfid() closefid() // for lookup closefid(removefid()) it bothers me that this is one more closefid than you mentioned. russ