[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: fix /proc/PID/maps parser format string
From: |
gnunet |
Subject: |
[gnunet] branch master updated: fix /proc/PID/maps parser format string |
Date: |
Sat, 02 Jan 2021 11:25:15 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 0d4337da2 fix /proc/PID/maps parser format string
0d4337da2 is described below
commit 0d4337da23548f4779d44c1416f51f087261141e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Jan 2 11:24:26 2021 +0100
fix /proc/PID/maps parser format string
---
contrib/Makefile.inc | 3 +-
src/util/os_installation.c | 23 ++++++++-------
src/util/plugin.c | 71 ++++++++++++++++++++++++++++++++--------------
3 files changed, 64 insertions(+), 33 deletions(-)
diff --git a/contrib/Makefile.inc b/contrib/Makefile.inc
index c737a07f8..a563ef4a1 100644
--- a/contrib/Makefile.inc
+++ b/contrib/Makefile.inc
@@ -8,7 +8,8 @@ BUILDCOMMON_SHLIB_FILES = \
build-common/sh/lib.sh/existence_python.sh \
build-common/sh/lib.sh/msg.sh \
build-common/sh/lib.sh/progname.sh \
- build-common/sh/lib.sh/version_gnunet.sh
+ build-common/sh/lib.sh/version_gnunet.sh \
+ build-common/LICENSE
BUILDCOMMON_CONF_FILES = \
build-common/conf/.dir-locals.el \
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index 6e783a95a..d1e5e0da5 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -142,7 +142,7 @@ GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd)
* @return NULL on error
*/
static char *
-get_path_from_proc_maps ()
+get_path_from_proc_maps (void)
{
char fn[64];
char line[1024];
@@ -152,15 +152,19 @@ get_path_from_proc_maps ()
if (NULL == current_pd->libname)
return NULL;
- GNUNET_snprintf (fn, sizeof(fn), "/proc/%u/maps", getpid ());
+ GNUNET_snprintf (fn,
+ sizeof(fn),
+ "/proc/%u/maps",
+ getpid ());
if (NULL == (f = fopen (fn, "r")))
return NULL;
while (NULL != fgets (line, sizeof(line), f))
{
if ((1 == sscanf (line,
- "%*x-%*x %*c%*c%*c%*c %*x %*2x:%*2x %*u%*[ ]%1023s",
+ "%*p-%*p %*c%*c%*c%*c %*x %*x:%*x %*u%*[ ]%1023s",
dir)) &&
- (NULL != (lgu = strstr (dir, current_pd->libname))))
+ (NULL != (lgu = strstr (dir,
+ current_pd->libname))))
{
lgu[0] = '\0';
fclose (f);
@@ -178,7 +182,7 @@ get_path_from_proc_maps ()
* @return NULL on error
*/
static char *
-get_path_from_proc_exe ()
+get_path_from_proc_exe (void)
{
char fn[64];
char lnk[1024];
@@ -232,7 +236,7 @@ typedef int (*MyNSGetExecutablePathProto) (char *buf,
size_t *bufsize);
* @return NULL on error
*/
static char *
-get_path_from_NSGetExecutablePath ()
+get_path_from_NSGetExecutablePath (void)
{
static char zero = '\0';
char *path;
@@ -270,7 +274,7 @@ get_path_from_NSGetExecutablePath ()
* @return NULL on error
*/
static char *
-get_path_from_dyld_image ()
+get_path_from_dyld_image (void)
{
const char *path;
char *p;
@@ -359,7 +363,7 @@ get_path_from_PATH (const char *binary)
* @return NULL on error (environment variable not set)
*/
static char *
-get_path_from_GNUNET_PREFIX ()
+get_path_from_GNUNET_PREFIX (void)
{
const char *p;
@@ -380,7 +384,7 @@ get_path_from_GNUNET_PREFIX ()
* @return a pointer to the executable path, or NULL on error
*/
static char *
-os_get_gnunet_path ()
+os_get_gnunet_path (void)
{
char *ret;
@@ -461,7 +465,6 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
* guess for the current app */
if (NULL == execpath)
execpath = os_get_gnunet_path ();
-
if (NULL == execpath)
return NULL;
diff --git a/src/util/plugin.c b/src/util/plugin.c
index bb310ada8..d169bc911 100644
--- a/src/util/plugin.c
+++ b/src/util/plugin.c
@@ -72,7 +72,7 @@ static struct PluginList *plugins;
* Setup libtool paths.
*/
static void
-plugin_init ()
+plugin_init (void)
{
int err;
const char *opath;
@@ -95,7 +95,10 @@ plugin_init ()
{
if (NULL != opath)
{
- GNUNET_asprintf (&cpath, "%s:%s", opath, path);
+ GNUNET_asprintf (&cpath,
+ "%s:%s",
+ opath,
+ path);
lt_dlsetsearchpath (cpath);
GNUNET_free (path);
GNUNET_free (cpath);
@@ -113,7 +116,7 @@ plugin_init ()
* Shutdown libtool.
*/
static void
-plugin_fini ()
+plugin_fini (void)
{
lt_dlsetsearchpath (old_dlsearchpath);
if (NULL != old_dlsearchpath)
@@ -133,15 +136,21 @@ plugin_fini ()
* @return NULL if the symbol was not found
*/
static GNUNET_PLUGIN_Callback
-resolve_function (struct PluginList *plug, const char *name)
+resolve_function (struct PluginList *plug,
+ const char *name)
{
char *initName;
void *mptr;
- GNUNET_asprintf (&initName, "_%s_%s", plug->name, name);
- mptr = lt_dlsym (plug->handle, &initName[1]);
+ GNUNET_asprintf (&initName,
+ "_%s_%s",
+ plug->name,
+ name);
+ mptr = lt_dlsym (plug->handle,
+ &initName[1]);
if (NULL == mptr)
- mptr = lt_dlsym (plug->handle, initName);
+ mptr = lt_dlsym (plug->handle,
+ initName);
if (NULL == mptr)
LOG (GNUNET_ERROR_TYPE_ERROR,
_ ("`%s' failed to resolve method '%s' with error: %s\n"),
@@ -179,7 +188,8 @@ GNUNET_PLUGIN_test (const char *library_name)
return GNUNET_NO;
plug.handle = libhandle;
plug.name = (char *) library_name;
- init = resolve_function (&plug, "init");
+ init = resolve_function (&plug,
+ "init");
if (NULL == init)
{
GNUNET_break (0);
@@ -204,7 +214,8 @@ GNUNET_PLUGIN_test (const char *library_name)
* @return whatever the initialization function returned
*/
void *
-GNUNET_PLUGIN_load (const char *library_name, void *arg)
+GNUNET_PLUGIN_load (const char *library_name,
+ void *arg)
{
void *libhandle;
struct PluginList *plug;
@@ -217,7 +228,7 @@ GNUNET_PLUGIN_load (const char *library_name, void *arg)
plugin_init ();
}
libhandle = lt_dlopenext (library_name);
- if (libhandle == NULL)
+ if (NULL == libhandle)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
_ ("`%s' failed for library `%s' with error: %s\n"),
@@ -231,8 +242,10 @@ GNUNET_PLUGIN_load (const char *library_name, void *arg)
plug->name = GNUNET_strdup (library_name);
plug->next = plugins;
plugins = plug;
- init = resolve_function (plug, "init");
- if ((init == NULL) || (NULL == (ret = init (arg))))
+ init = resolve_function (plug,
+ "init");
+ if ( (NULL == init) ||
+ (NULL == (ret = init (arg))) )
{
lt_dlclose (libhandle);
GNUNET_free (plug->name);
@@ -253,7 +266,8 @@ GNUNET_PLUGIN_load (const char *library_name, void *arg)
* @return whatever the shutdown function returned
*/
void *
-GNUNET_PLUGIN_unload (const char *library_name, void *arg)
+GNUNET_PLUGIN_unload (const char *library_name,
+ void *arg)
{
struct PluginList *pos;
struct PluginList *prev;
@@ -262,7 +276,9 @@ GNUNET_PLUGIN_unload (const char *library_name, void *arg)
prev = NULL;
pos = plugins;
- while ((NULL != pos) && (0 != strcmp (pos->name, library_name)))
+ while ( (NULL != pos) &&
+ (0 != strcmp (pos->name,
+ library_name)) )
{
prev = pos;
pos = pos->next;
@@ -270,7 +286,8 @@ GNUNET_PLUGIN_unload (const char *library_name, void *arg)
if (NULL == pos)
return NULL;
- done = resolve_function (pos, "done");
+ done = resolve_function (pos,
+ "done");
ret = NULL;
if (NULL != done)
ret = done (arg);
@@ -327,7 +344,8 @@ struct LoadAllContext
* @return #GNUNET_OK (continue loading)
*/
static int
-find_libraries (void *cls, const char *filename)
+find_libraries (void *cls,
+ const char *filename)
{
struct LoadAllContext *lac = cls;
const char *slashpos;
@@ -338,19 +356,26 @@ find_libraries (void *cls, const char *filename)
size_t n;
libname = filename;
- while (NULL != (slashpos = strstr (libname, DIR_SEPARATOR_STR)))
+ while (NULL != (slashpos = strstr (libname,
+ DIR_SEPARATOR_STR)))
libname = slashpos + 1;
n = strlen (libname);
- if (0 != strncmp (lac->basename, libname, strlen (lac->basename)))
+ if (0 != strncmp (lac->basename,
+ libname,
+ strlen (lac->basename)))
return GNUNET_OK; /* wrong name */
- if ((n > 3) && (0 == strcmp (&libname[n - 3], ".la")))
+ if ( (n > 3) &&
+ (0 == strcmp (&libname[n - 3], ".la")) )
return GNUNET_OK; /* .la file */
basename = GNUNET_strdup (libname);
if (NULL != (dot = strstr (basename, ".")))
*dot = '\0';
- lib_ret = GNUNET_PLUGIN_load (basename, lac->arg);
+ lib_ret = GNUNET_PLUGIN_load (basename,
+ lac->arg);
if (NULL != lib_ret)
- lac->cb (lac->cb_cls, basename, lib_ret);
+ lac->cb (lac->cb_cls,
+ basename,
+ lib_ret);
GNUNET_free (basename);
return GNUNET_OK;
}
@@ -388,7 +413,9 @@ GNUNET_PLUGIN_load_all (const char *basename,
lac.arg = arg;
lac.cb = cb;
lac.cb_cls = cb_cls;
- GNUNET_DISK_directory_scan (path, &find_libraries, &lac);
+ GNUNET_DISK_directory_scan (path,
+ &find_libraries,
+ &lac);
GNUNET_free (path);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: fix /proc/PID/maps parser format string,
gnunet <=