Skip to contentSkip to conversation

syscalls/fcntl35.c: fix wrong fds[0] && cleanup

PATCH New Xiao Yang 2 participants 2 messages Jun 16, 2017 – Jun 19, 2017

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 syscalls/fcntl35.c: fix wrong fds[0] && cleanup

---
 testcases/kernel/syscalls/fcntl/fcntl35.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/fcntl/fcntl35.c +3 -5
index 087e779..b984584 100644
@@ -46,7 +46,7 @@
 
 static int pipe_max_unpriv;
 static int test_max_unpriv = 4096;
-struct passwd *pw;
+static struct passwd *pw;
 static struct tcase {
 	int exp_sz;
 	int exp_usr;
@@ -78,7 +78,7 @@ static void cleanup(void)
 static int verify_pipe_size(int exp_pip_sz, char *desp)
 {
 	int get_size;
-	int fds[0];
+	int fds[2];
 
 	SAFE_PIPE(fds);
 
@@ -109,11 +109,9 @@ end:
 
 static void do_test(unsigned int n)
 {
-	pid_t pid;
 	struct tcase *tc = &tcases[n];
 
-	pid = SAFE_FORK();
-	if (!pid) {
+	if (!SAFE_FORK()) {
 		if (tc->exp_usr)
 			SAFE_SETUID(pw->pw_uid);
 
Signature · 1 line
1.8.3.1