Cast execl*() NULL sentinels to (char *)
The NULL sentinel argument to the execl*() family of calls must be cast to (char *), as otherwise: - platforms where NULL is just 0 (not (void *)) would pass an int - (admittedly esoteric) platforms where NULL is (void *)0 and (void *) and (char *) have different memory layouts would pass the wrong kind of pointer Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Rast committed
Jul 24, 2010 at 17:20 UTC
5d314759d787885c2cc389efbfb3aea1c47b56d9
1 file changed
+6
-6
builtin/help.c
+6
-6
@@ -120,7 +120,7 @@ static void exec_woman_emacs(const char *path, const char *page)
120
if (!path)
121
path = "emacsclient";
122
strbuf_addf(&man_page, "(woman \"%s\")", page);
123
- execlp(path, "emacsclient", "-e", man_page.buf, NULL);
123
+ execlp(path, "emacsclient", "-e", man_page.buf, (char *)NULL);
124
warning("failed to exec '%s': %s", path, strerror(errno));
125
}
126
}
@@ -148,7 +148,7 @@ static void exec_man_konqueror(const char *path, const char *page)
148
} else
149
path = "kfmclient";
150
strbuf_addf(&man_page, "man:%s(1)", page);
151
- execlp(path, filename, "newTab", man_page.buf, NULL);
151
+ execlp(path, filename, "newTab", man_page.buf, (char *)NULL);
152
warning("failed to exec '%s': %s", path, strerror(errno));
153
}
154
}
@@ -157,7 +157,7 @@ static void exec_man_man(const char *path, const char *page)
157
{
158
if (!path)
159
path = "man";
160
- execlp(path, "man", page, NULL);
160
+ execlp(path, "man", page, (char *)NULL);
161
warning("failed to exec '%s': %s", path, strerror(errno));
162
}
163
@@ -165,7 +165,7 @@ static void exec_man_cmd(const char *cmd, const char *page)
165
{
166
struct strbuf shell_cmd = STRBUF_INIT;
167
strbuf_addf(&shell_cmd, "%s %s", cmd, page);
168
- execl("/bin/sh", "sh", "-c", shell_cmd.buf, NULL);
168
+ execl("/bin/sh", "sh", "-c", shell_cmd.buf, (char *)NULL);
169
warning("failed to exec '%s': %s", cmd, strerror(errno));
170
}
171
@@ -372,7 +372,7 @@ static void show_info_page(const char *git_cmd)
372
{
373
const char *page = cmd_to_page(git_cmd);
374
setenv("INFOPATH", system_path(GIT_INFO_PATH), 1);
375
- execlp("info", "info", "gitman", page, NULL);
375
+ execlp("info", "info", "gitman", page, (char *)NULL);
376
die("no info viewer handled the request");
377
}
378
@@ -398,7 +398,7 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
398
#ifndef open_html
399
static void open_html(const char *path)
400
{
401
- execl_git_cmd("web--browse", "-c", "help.browser", path, NULL);
401
+ execl_git_cmd("web--browse", "-c", "help.browser", path, (char *)NULL);
402
}
403
#endif
404