# HG changeset patch # User Yuya Nishihara # Date 1461501330 -32400 # Node ID 94451300f3ec4a81135d3cf86ca3dce13e53837b # Parent 87d4a6c5567e81386b8c2209d95060d5bf72e064 chg: initialize sockdirfd to -1 instead of AT_FDCWD As we don't use sockdirfd yet, this is the simplest workaround to compile chg on old Unices where AT_FDCWD does not exist. Foozy pointed out Mac OS X 10.10 is required for AT_FDCWD as well as xxxat() functions. diff -r 87d4a6c5567e -r 94451300f3ec contrib/chg/chg.c --- a/contrib/chg/chg.c Fri Apr 22 13:38:02 2016 -0500 +++ b/contrib/chg/chg.c Sun Apr 24 21:35:30 2016 +0900 @@ -42,7 +42,7 @@ static void initcmdserveropts(struct cmdserveropts *opts) { memset(opts, 0, sizeof(struct cmdserveropts)); opts->lockfd = -1; - opts->sockdirfd = AT_FDCWD; + opts->sockdirfd = -1; } static void freecmdserveropts(struct cmdserveropts *opts) { @@ -50,9 +50,9 @@ opts->args = NULL; opts->argsize = 0; assert(opts->lockfd == -1 && "should be closed by unlockcmdserver()"); - if (opts->sockdirfd != AT_FDCWD) { + if (opts->sockdirfd >= 0) { close(opts->sockdirfd); - opts->sockdirfd = AT_FDCWD; + opts->sockdirfd = -1; } }