forked from osmocom/wireshark
Change the signature of init_progfile_dir() so the casting of the
function pointer (to main) to an argument to dladdr() is done in init_progfile_dir() rather than its callers. svn path=/trunk/; revision=27814daniel/osmux
parent
6f059e8cb7
commit
c73ab7dff7
|
@ -302,7 +302,7 @@ main(int argc, char *argv[])
|
|||
#ifdef HAVE_PLUGINS
|
||||
/* Register wiretap plugins */
|
||||
|
||||
if ((init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main))) {
|
||||
if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) {
|
||||
g_warning("capinfos: init_progfile_dir(): %s", init_progfile_dir_error);
|
||||
g_free(init_progfile_dir_error);
|
||||
} else {
|
||||
|
|
2
dftest.c
2
dftest.c
|
@ -75,7 +75,7 @@ main(int argc, char **argv)
|
|||
/*
|
||||
* Attempt to get the pathname of the executable file.
|
||||
*/
|
||||
init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
|
||||
init_progfile_dir_error = init_progfile_dir(argv[0], main);
|
||||
if (init_progfile_dir_error != NULL) {
|
||||
fprintf(stderr, "dftest: Can't get pathname of dftest program: %s.\n",
|
||||
init_progfile_dir_error);
|
||||
|
|
|
@ -424,7 +424,7 @@ main(int argc, char *argv[])
|
|||
|
||||
#ifdef HAVE_PLUGINS
|
||||
/* Register wiretap plugins */
|
||||
if ((init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main))) {
|
||||
if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) {
|
||||
g_warning("capinfos: init_progfile_dir(): %s", init_progfile_dir_error);
|
||||
g_free(init_progfile_dir_error);
|
||||
} else {
|
||||
|
|
|
@ -249,7 +249,7 @@ init_progfile_dir(const char *arg0
|
|||
#ifdef _WIN32
|
||||
_U_
|
||||
#endif
|
||||
, void *main_addr
|
||||
, int (*main_addr)(int, char **)
|
||||
#if defined(_WIN32) || !defined(DLADDR_FINDS_EXECUTABLE_PATH)
|
||||
_U_
|
||||
#endif
|
||||
|
@ -369,7 +369,7 @@ init_progfile_dir(const char *arg0
|
|||
/*
|
||||
* Try to use dladdr() to find the pathname of the executable.
|
||||
*/
|
||||
if (dladdr(main_addr, &info) && info.dli_fname[0] == '/') {
|
||||
if (dladdr((void *)main_addr, &info) && info.dli_fname[0] == '/') {
|
||||
/*
|
||||
* dladdr() succeeded, and we got an absolute path
|
||||
* for the module containing main() (I don't know
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
* and save it for future use. Returns NULL on success, and a
|
||||
* g_mallocated string containing an error on failure.
|
||||
*/
|
||||
extern char *init_progfile_dir(const char *arg0, void *main_addr);
|
||||
extern char *init_progfile_dir(const char *arg0, int (*main)(int, char **));
|
||||
|
||||
/*
|
||||
* Get the directory in which the program resides.
|
||||
|
|
|
@ -1808,7 +1808,7 @@ main(int argc, char *argv[])
|
|||
/*
|
||||
* Attempt to get the pathname of the executable file.
|
||||
*/
|
||||
init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
|
||||
init_progfile_dir_error = init_progfile_dir(argv[0], main);
|
||||
|
||||
/* initialize the funnel mini-api */
|
||||
initialize_funnel_ops();
|
||||
|
|
|
@ -460,7 +460,7 @@ main(int argc, char *argv[])
|
|||
/*
|
||||
* Attempt to get the pathname of the executable file.
|
||||
*/
|
||||
init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
|
||||
init_progfile_dir_error = init_progfile_dir(argv[0], main);
|
||||
if (init_progfile_dir_error != NULL) {
|
||||
fprintf(stderr, "rawshark: Can't get pathname of rawshark program: %s.\n",
|
||||
init_progfile_dir_error);
|
||||
|
|
2
tshark.c
2
tshark.c
|
@ -773,7 +773,7 @@ main(int argc, char *argv[])
|
|||
/*
|
||||
* Attempt to get the pathname of the executable file.
|
||||
*/
|
||||
init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
|
||||
init_progfile_dir_error = init_progfile_dir(argv[0], main);
|
||||
if (init_progfile_dir_error != NULL) {
|
||||
fprintf(stderr, "tshark: Can't get pathname of tshark program: %s.\n",
|
||||
init_progfile_dir_error);
|
||||
|
|
Loading…
Reference in New Issue