Skip to contentSkip to conversation

network/nfsv4/acl: Second argument is execl should be a null-terminated array

PATCH NAK Markos Chandras 2 participants 2 messages Jan 3, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 21/21 network/nfsv4/acl: Second argument is execl should be a null-terminated array

Hi, please review the attached patch

Signature · 1 line
markos

From d83355aa7d9c197a60a1f1c5e495fa049a2f1861 Mon Sep 17 00:00:00 2001
From: Markos Chandras <[email protected]>
Date: Thu, 22 Dec 2011 15:25:03 +0000
Subject: [PATCH 21/21] network/nfsv4/acl: Second argument is execl should be a null-terminated array

From exec manpage:
"The const char *arg and subsequent ellipses in the execl(), execlp(), and
execle() functions can be thought of as arg0, arg1, ..., argn. Together
they describe a list of one or more pointers to null-terminated strings that represent the argument list available to the executed program". This change will silence gcc warnings.

---
 testcases/network/nfsv4/acl/acl1.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
testcases/network/nfsv4/acl/acl1.c +2 -1
index 18a92a0..5040eee 100644
@@ -57,12 +57,13 @@ int do_file_op(char* filename) {
 	result = 0;
 	FILE *fptr;
 	char str[256] = "./";
+	const char execl_args[] = {'\0'};
 	fptr = malloc(sizeof(FILE));
 
 	uid = geteuid();
 	strcat(str, filename);
 
-	exe = execl(str,NULL,NULL);
+	exe = execl(str,execl_args,NULL);
 	if (exe == -1 && errno!=EACCES)
 		result = result + OP_EXEC;
 
Signature · 1 line
1.7.1

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 1 line · Markos Chandras

Hi, please review the attached patch

You could always just do it like:

execl(..., { 0 }, ...);

Thanks,
-Garrett

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list