contrib/chg/hgclient.c
changeset 28855 f5764e177bbe
parent 28789 7f6e0a15189b
child 29581 c66bc06f1bf6
--- a/contrib/chg/hgclient.c	Sun Apr 10 03:14:32 2016 +0100
+++ b/contrib/chg/hgclient.c	Mon Apr 11 00:17:17 2016 +0100
@@ -418,11 +418,7 @@
 
 	/* don't keep fd on fork(), so that it can be closed when the parent
 	 * process get terminated. */
-	int flags = fcntl(fd, F_GETFD);
-	if (flags < 0)
-		abortmsgerrno("cannot get flags of socket");
-	if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0)
-		abortmsgerrno("cannot set flags of socket");
+	fsetcloexec(fd);
 
 	struct sockaddr_un addr;
 	addr.sun_family = AF_UNIX;