Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH 2/2] close_lock_file(): new function in the lockfile API

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:44:05

Possibly related (same subject, not in this thread)


On Wed, 16 Jan 2008, Junio C Hamano wrote:
+
+void close_lock_file(struct lock_file *lk)
+{
+	close(lk->fd);
+	lk->fd = -1;
+}
Since one of the main purposes of closing would be the error testing of 
writes that haven't made it out yet on filesystems like NFS that do 
open-close cache serialization, I'd suggest doing this as

	int close_lock_file(struct lock_file *lk)
	{
		int fd = lk->fd;
		lk->df = -1;
		return close(fd);
	} 

to give the return code.

		Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help