Commit Diff


commit - fcd9d510efc603189fd18f2dbdd7685d30298f70
commit + aa76fd7feb09deb66f083c71fe801b06896dabbd
blob - 8bab1f9ca2a3c21f8e76aae06c738e089defc1bc
blob + 51aa62d3f237693b68cc4e49660ff9eb1308b549
--- kamiftp/ftp.c
+++ kamiftp/ftp.c
@@ -919,6 +919,13 @@ tmp_file(char sfn[TMPFSTRLEN])
 		return -1;
 	}
 
+	/* set the close-on-exec flag */
+	if (fcntl(tmpfd, F_SETFD, FD_CLOEXEC) == -1) {
+		warn("fcntl");
+		close(tmpfd);
+		return -1;
+	}
+
 	return tmpfd;
 }