[PATCH 04 of 14] chg: check lockfd at freecmdserveropts
Jun Wu
quark at fb.com
Sun Apr 10 19:57:21 EDT 2016
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1460325491 -3600
# Sun Apr 10 22:58:11 2016 +0100
# Node ID f2400efd3bd61aef35de18b462d50611be4d77d1
# Parent 400fbf5ed12b8585bea9fee27abb250fa4c98bd1
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.
diff --git a/contrib/chg/chg.c b/contrib/chg/chg.c
--- a/contrib/chg/chg.c
+++ b/contrib/chg/chg.c
@@ -49,6 +49,8 @@
free(opts->args);
opts->args = NULL;
opts->argsize = 0;
+ /* lockfd should be closed by unlockcmdserver() */
+ assert(opts->lockfd == -1);
if (opts->sockdirfd != AT_FDCWD) {
close(opts->sockdirfd);
opts->sockdirfd = AT_FDCWD;
More information about the Mercurial-devel
mailing list