changeset 29016:94451300f3ec stable

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.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 24 Apr 2016 21:35:30 +0900
parents 87d4a6c5567e
children 07be86828e79
files contrib/chg/chg.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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;
 	}
 }