From: Benny Halevy <benny@tonian.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 08/10] fix compiler warnings around get_output use of argv
Date: Mon, 5 Dec 2011 10:14:12 +0200 [thread overview]
Message-ID: <1323072852-18448-1-git-send-email-benny@tonian.com> (raw)
In-Reply-To: <4EDC7C4E.1040901@tonian.com>
From: Benny Halevy <bhalevy@tonian.com>
Signed-off-by: Benny Halevy <bhalevy@tonian.com>
---
ctl.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/ctl.c b/ctl.c
index e5d16e3..f1d878d 100644
--- a/ctl.c
+++ b/ctl.c
@@ -52,7 +52,7 @@ static int __token_count(token_t *t);
static const char * __token_next(token_t *t);
static const char * __token_str(token_t *t);
static int __token_next_int(token_t *t);
-static int get_output(char *prog, const char **argv);
+static int get_output(char *prog, char * const *argv);
static char *find_dm_name(int major, int minor);
static void hexdump(char *p, int len, int off);
@@ -277,7 +277,7 @@ get_vers(bl_comm_msg_t *msg, bl_comm_res_t *res, int *len)
bl_comm_res_t *
get_dm(bl_comm_msg_t *msg, bl_comm_res_t *res, int *lenp)
{
- const char *argv[4] = {"dmsetup", "table", NULL, NULL};
+ char *argv[4] = {"dmsetup", "table", NULL, NULL};
char buf[128],
*name;
int major,
@@ -298,7 +298,7 @@ get_dm(bl_comm_msg_t *msg, bl_comm_res_t *res, int *lenp)
return res;
}
argv[2] = name;
- if (((fd = get_output("/sbin/dmsetup", argv)) == -1) ||
+ if (((fd = get_output("/sbin/dmsetup", (char * const *)argv)) == -1) ||
((fp = fdopen(fd, "r")) == NULL)) {
printf("%s: get_output/fdopen failed\n", __func__);
res->res_status = PNFS_BLOCK_FAILURE;
@@ -479,7 +479,7 @@ set_operation(int op)
static char *
find_dm_name(int major, int minor)
{
- const char *argv[5] = {"dmsetup", "ls", "--target", "striped", NULL};
+ char * const argv[5] = {"dmsetup", "ls", "--target", "striped", NULL};
char buf[128],
*name;
const char *majmin;
@@ -549,7 +549,7 @@ error:
}
static int
-get_output(char *prog, const char **argv)
+get_output(char *prog, char * const *argv)
{
int fildes[2];
@@ -567,13 +567,11 @@ get_output(char *prog, const char **argv)
close(fildes[0]);
dup2(fildes[1], 1);
dup2(fildes[1], 2);
- if (execv(prog, argv) == -1) {
- perror("execv");
- exit(1);
- }
- break;
+ execv(prog, argv);
+ perror("execv");
+ exit(1);
- default:
+ default:
close(fildes[1]);
return fildes[0];
}
--
1.7.6
next prev parent reply other threads:[~2011-12-05 8:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-05 8:09 [PATCH 0/10] pnfs-block ctl Benny Halevy
2011-12-05 8:12 ` [PATCH 01/10] use gcc Benny Halevy
2011-12-05 8:13 ` [PATCH 02/10] efi: fix user-land debug printouts Benny Halevy
2011-12-05 8:13 ` [PATCH 03/10] ctl: improve " Benny Halevy
2011-12-05 8:13 ` [PATCH 04/10] increase compiler warning level Benny Halevy
2011-12-05 8:13 ` [PATCH 05/10] ctl: always return a value from find_dm_name Benny Halevy
2011-12-05 8:13 ` [PATCH 06/10] add missing includes Benny Halevy
2011-12-05 8:14 ` [PATCH 07/10] ctl: fix compiler warnings Benny Halevy
2011-12-05 8:14 ` Benny Halevy [this message]
2011-12-05 8:14 ` [PATCH 09/10] ctl: main should return 0 on success Benny Halevy
2011-12-05 8:14 ` [PATCH 10/10] efi: fix compiler warnings Benny Halevy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1323072852-18448-1-git-send-email-benny@tonian.com \
--to=benny@tonian.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).