From 15c22a39385d8a5c4d73bc0d313fc00831aaff45 Mon Sep 17 00:00:00 2001
From: Michael Tuexen <tuexen@fh-muenster.de>
Date: Sat, 7 Oct 2017 20:30:43 +0200
Subject: [PATCH] Fix CID 187208.

---
 gtests/net/packetdrill/code.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gtests/net/packetdrill/code.c b/gtests/net/packetdrill/code.c
index 04f90888..5a062b24 100644
--- a/gtests/net/packetdrill/code.c
+++ b/gtests/net/packetdrill/code.c
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <unistd.h>
@@ -474,7 +475,10 @@ static void write_code_file(struct code_state *code)
 {
 	/* mkstemp will fill this in with the actual unique path name. */
 	char path_template[] = "/tmp/code_XXXXXX";
-	int code_fd = mkstemp(path_template);
+	int code_fd;
+
+	umask(S_IRUSR | S_IWUSR);
+	code_fd = mkstemp(path_template);
 	if (code_fd < 0)
 		die_perror("error making temp output file for code: mkstemp");
 
-- 
GitLab