Commit Diff


commit - a631263a240217668a3f9e15bef0630795b1a197
commit + 1b7a3cb7967ecbc9dda25feadab718cecc77b335
blob - cdea67ae3e8133634c010f9f04eca641e3c077e1
blob + 81e2865274bf6832ad16a6ec0e16bfe24c150469
--- gotd/gotd.c
+++ gotd/gotd.c
@@ -3442,9 +3442,14 @@ main(int argc, char **argv)
 					break;
 				}
 				gotd_socket = imsg_get_fd(&imsg);
-				if (gotd_socket != -1)
+				if (gotd_socket == -1) {
+					error = got_error(
+					    GOT_ERR_PRIVSEP_NO_FD);
 					break;
-				error = got_error(GOT_ERR_PRIVSEP_NO_FD);
+				}
+				if (fcntl(gotd_socket,
+				    F_SETFD, FD_CLOEXEC) == -1)
+					error = got_error_from_errno("fcntl");
 				break;
 			case GOTD_IMSG_RELOAD_SECRETS:
 				if (have_reload_secrets) {