changeset 28853:d11548b4ae45

chg: check lockfd at freecmdserveropts We check for sockdirfd at freecmdserveropts but not lockfd, which is a bit strange to people new to the code. Add a comment and an assert to make it clear that lockfd should be closed earlier.
author Jun Wu <quark@fb.com>
date Sun, 10 Apr 2016 22:58:11 +0100
parents 7b5f5a1b4b41
children ddef14468952
files contrib/chg/chg.c
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/chg/chg.c	Sun Apr 10 23:56:00 2016 +0100
+++ b/contrib/chg/chg.c	Sun Apr 10 22:58:11 2016 +0100
@@ -49,6 +49,7 @@
 	free(opts->args);
 	opts->args = NULL;
 	opts->argsize = 0;
+	assert(opts->lockfd == -1 && "should be closed by unlockcmdserver()");
 	if (opts->sockdirfd != AT_FDCWD) {
 		close(opts->sockdirfd);
 		opts->sockdirfd = AT_FDCWD;