# HG changeset patch # User Jun Wu # Date 2016-04-10 21:58:11 # Node ID d11548b4ae456941bf46195e11309ad73155e0c1 # Parent 7b5f5a1b4b41598fc4d4289c5b7e234a0dff8e9a 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,7 @@ static void freecmdserveropts(struct cmd 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;