Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Cast execl*() NULL sentinels to (char *)
author
Thomas Rast
<trast@student.ethz.ch>
Sat, 24 Jul 2010 15:20:23 +0000
(17:20 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 26 Jul 2010 06:14:18 +0000
(23:14 -0700)
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>
builtin/help.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
cdad3c5
)
diff --git
a/builtin/help.c
b/builtin/help.c
index a9836b00aec8df68e7a615dce83d3c60f73e242f..61ff79839bc4778451425d0ae1cfd199247954a1 100644
(file)
--- a/
builtin/help.c
+++ b/
builtin/help.c
@@
-120,7
+120,7
@@
static void exec_woman_emacs(const char *path, const char *page)
if (!path)
path = "emacsclient";
strbuf_addf(&man_page, "(woman \"%s\")", page);
if (!path)
path = "emacsclient";
strbuf_addf(&man_page, "(woman \"%s\")", page);
- execlp(path, "emacsclient", "-e", man_page.buf, NULL);
+ execlp(path, "emacsclient", "-e", man_page.buf,
(char *)
NULL);
warning("failed to exec '%s': %s", path, strerror(errno));
}
}
warning("failed to exec '%s': %s", path, strerror(errno));
}
}
@@
-148,7
+148,7
@@
static void exec_man_konqueror(const char *path, const char *page)
} else
path = "kfmclient";
strbuf_addf(&man_page, "man:%s(1)", page);
} else
path = "kfmclient";
strbuf_addf(&man_page, "man:%s(1)", page);
- execlp(path, filename, "newTab", man_page.buf, NULL);
+ execlp(path, filename, "newTab", man_page.buf,
(char *)
NULL);
warning("failed to exec '%s': %s", path, strerror(errno));
}
}
warning("failed to exec '%s': %s", path, strerror(errno));
}
}
@@
-157,7
+157,7
@@
static void exec_man_man(const char *path, const char *page)
{
if (!path)
path = "man";
{
if (!path)
path = "man";
- execlp(path, "man", page, NULL);
+ execlp(path, "man", page,
(char *)
NULL);
warning("failed to exec '%s': %s", path, strerror(errno));
}
warning("failed to exec '%s': %s", path, strerror(errno));
}
@@
-165,7
+165,7
@@
static void exec_man_cmd(const char *cmd, const char *page)
{
struct strbuf shell_cmd = STRBUF_INIT;
strbuf_addf(&shell_cmd, "%s %s", cmd, page);
{
struct strbuf shell_cmd = STRBUF_INIT;
strbuf_addf(&shell_cmd, "%s %s", cmd, page);
- execl("/bin/sh", "sh", "-c", shell_cmd.buf, NULL);
+ execl("/bin/sh", "sh", "-c", shell_cmd.buf,
(char *)
NULL);
warning("failed to exec '%s': %s", cmd, strerror(errno));
}
warning("failed to exec '%s': %s", cmd, strerror(errno));
}
@@
-372,7
+372,7
@@
static void show_info_page(const char *git_cmd)
{
const char *page = cmd_to_page(git_cmd);
setenv("INFOPATH", system_path(GIT_INFO_PATH), 1);
{
const char *page = cmd_to_page(git_cmd);
setenv("INFOPATH", system_path(GIT_INFO_PATH), 1);
- execlp("info", "info", "gitman", page, NULL);
+ execlp("info", "info", "gitman", page,
(char *)
NULL);
die("no info viewer handled the request");
}
die("no info viewer handled the request");
}
@@
-398,7
+398,7
@@
static void get_html_page_path(struct strbuf *page_path, const char *page)
#ifndef open_html
static void open_html(const char *path)
{
#ifndef open_html
static void open_html(const char *path)
{
- execl_git_cmd("web--browse", "-c", "help.browser", path, NULL);
+ execl_git_cmd("web--browse", "-c", "help.browser", path,
(char *)
NULL);
}
#endif
}
#endif