From 7ca9930ec1fc0aef059a2d8e81f7db6b3c1085ce Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 26 Nov 2010 13:21:07 +0100 Subject: reorganize libraries This patch does not change any code per se, it renames libABRTfoo -> libabrt_bar and moves a few functions around. After the patch, we are left with the following libs: libabrt - the stuff shared among most of abrt (like xmalloc, logging) libabrt_daemon - only daemon-related things are here (should probably be just moved into daemon - later) libabrt_dbus - daemon, cli and applet use this libabrt_web - abrt-action-foo where foo deals with network/web/ftp/... As a result, we have following reductions in dependent libs: /usr/libexec/abrt-hook-ccpp: linux-vdso.so.1 => () - libABRTUtils.so.0 => /usr/lib64/libABRTUtils.so.0 () + libabrt.so.0 => /usr/lib64/libabrt.so.0 () libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 () - libdbus-1.so.3 => /lib64/libdbus-1.so.3 () - libpthread.so.0 => /lib64/libpthread.so.0 () - librt.so.1 => /lib64/librt.so.1 () - libdl.so.2 => /lib64/libdl.so.2 () /usr/libexec/abrt-action-upload: linux-vdso.so.1 => () libtar.so.1 => /usr/lib64/libtar.so.1 () libcurl.so.4 => /usr/lib64/libcurl.so.4 () - libABRTdUtils.so.0 => /usr/lib64/libABRTdUtils.so.0 () - libABRTUtils.so.0 => /usr/lib64/libABRTUtils.so.0 () + libabrt.so.0 => /usr/lib64/libabrt.so.0 () libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 () - libdbus-1.so.3 => /lib64/libdbus-1.so.3 () Similar savings are in almost every abrt-action-foo. Signed-off-by: Denys Vlasenko --- src/lib/Makefile.am | 81 ++++++++++++++--------- src/lib/Plugin.cpp | 75 --------------------- src/lib/abrt_packages.c | 43 ------------ src/lib/abrt_packages.h | 33 ---------- src/lib/daemon.c | 139 --------------------------------------- src/lib/daemon_is_ok.c | 51 ++++++++++++++ src/lib/get_cmdline.c | 105 +++++++++++++++++++++++++++++ src/lib/load_plugin_settings.cpp | 94 ++++++++++++++++++++++++++ src/lib/make_descr.cpp | 2 +- 9 files changed, 301 insertions(+), 322 deletions(-) delete mode 100644 src/lib/abrt_packages.c delete mode 100644 src/lib/abrt_packages.h delete mode 100644 src/lib/daemon.c create mode 100644 src/lib/daemon_is_ok.c create mode 100644 src/lib/get_cmdline.c create mode 100644 src/lib/load_plugin_settings.cpp (limited to 'src/lib') diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 0561e316..92f5e645 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -1,10 +1,13 @@ -# ABRTUtils has small set of deps. This reduces deps of smaller abrt binaries -# ABRTdUtils has much more. It is used by daemon and plugins only -# ABRT_web_utils is used only by some abrt-action-foo programs, not by daemon +# libabrt - the stuff shared among most of abrt (like xmalloc, logging) +# libabrt_daemon - only daemon/server/dbus related things are here +# libabrt_dbus - daemon, cli and applet use this +# libabrt_web - abrt-action-foo where foo deals with network/web/ftp/... lib_LTLIBRARIES = \ - libABRTUtils.la \ - libABRTdUtils.la \ - libABRT_web_utils.la + libabrt.la \ + libabrt_daemon.la \ + libabrt_dbus.la \ + libabrt_web.la + HEADER_DIR = $(srcdir)/../include AM_CPPFLAGS = -I$(HEADER_DIR) @@ -12,11 +15,8 @@ AM_CPPFLAGS = -I$(HEADER_DIR) # time.cpp # xconnect.cpp -libABRTUtils_la_SOURCES = \ +libabrt_la_SOURCES = \ xfuncs.c \ - concat_path_file.c \ - append_to_malloced_string.c \ - overlapping_strcpy.c \ encbase64.c \ stdio_helpers.c \ hash_md5.c hash_md5.h \ @@ -24,22 +24,44 @@ libABRTUtils_la_SOURCES = \ read_write.c read_write.h \ logging.c logging.h \ copyfd.c \ - daemon.c \ + concat_path_file.c \ + append_to_malloced_string.c \ + overlapping_strcpy.c \ skip_whitespace.c \ + stringops.cpp \ + strbuf.c strbuf.h \ xatonum.c numtoa.cpp \ spawn.c \ - stringops.cpp \ dirsize.c \ dump_dir.c \ - strbuf.c strbuf.h \ - abrt_dbus.c abrt_dbus.h \ + get_cmdline.c \ + daemon_is_ok.c \ + load_plugin_settings.cpp \ + make_descr.cpp \ + run_event.c \ CrashTypes.cpp \ ABRTException.cpp \ - run_event.c \ - abrt_packages.c abrt_packages.h \ hooklib.c hooklib.h \ + parse_release.cpp \ parse_options.c parse_options.h -libABRTUtils_la_CPPFLAGS = \ +libabrt_la_CPPFLAGS = \ + -Wall -Werror \ + -I$(srcdir)/../include \ + -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ + -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \ + -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ + -DCONF_DIR=\"$(CONF_DIR)\" \ + -DVAR_RUN=\"$(VAR_RUN)\" \ + $(GLIB_CFLAGS) \ + -D_GNU_SOURCE +libabrt_la_LDFLAGS = \ + -version-info 0:1:0 +libabrt_la_LIBADD = \ + $(GLIB_LIBS) + +libabrt_dbus_la_SOURCES = \ + abrt_dbus.c abrt_dbus.h +libabrt_dbus_la_CPPFLAGS = \ -Wall -Werror \ -I$(srcdir)/../include \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ @@ -50,19 +72,16 @@ libABRTUtils_la_CPPFLAGS = \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ -D_GNU_SOURCE -libABRTUtils_la_LDFLAGS = \ +libabrt_dbus_la_LDFLAGS = \ -version-info 0:1:0 -libABRTUtils_la_LIBADD = \ +libabrt_dbus_la_LIBADD = \ $(GLIB_LIBS) \ - $(DBUS_LIBS) \ - -ldl + $(DBUS_LIBS) -libABRTdUtils_la_SOURCES = \ - parse_release.cpp \ - make_descr.cpp \ +libabrt_daemon_la_SOURCES = \ $(HEADER_DIR)/comm_layer_inner.h CommLayerInner.cpp \ $(HEADER_DIR)/plugin.h Plugin.cpp -libABRTdUtils_la_CPPFLAGS = \ +libabrt_daemon_la_CPPFLAGS = \ -Wall \ -I$(srcdir)/../include \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ @@ -71,15 +90,15 @@ libABRTdUtils_la_CPPFLAGS = \ -DCONF_DIR=\"$(CONF_DIR)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ -D_GNU_SOURCE -libABRTdUtils_la_LDFLAGS = \ +libabrt_daemon_la_LDFLAGS = \ -version-info 0:1:0 -libABRTdUtils_la_LIBADD = \ +libabrt_daemon_la_LIBADD = \ -ldl -libABRT_web_utils_la_SOURCES = \ +libabrt_web_la_SOURCES = \ abrt_curl.h abrt_curl.c \ abrt_xmlrpc.h abrt_xmlrpc.cpp -libABRT_web_utils_la_CPPFLAGS = \ +libabrt_web_la_CPPFLAGS = \ -Wall -Werror \ -I$(srcdir)/../include \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ @@ -91,9 +110,9 @@ libABRT_web_utils_la_CPPFLAGS = \ $(LIBXML_CFLAGS) \ $(XMLRPC_CFLAGS) $(XMLRPC_CLIENT_CFLAGS) \ -D_GNU_SOURCE -libABRT_web_utils_la_LDFLAGS = \ +libabrt_web_la_LDFLAGS = \ -version-info 0:1:0 -libABRT_web_utils_la_LIBADD = \ +libabrt_web_la_LIBADD = \ $(CURL_LIBS) \ $(LIBXML_LIBS) \ $(XMLRPC_LIBS) $(XMLRPC_CLIENT_LIBS) diff --git a/src/lib/Plugin.cpp b/src/lib/Plugin.cpp index bf237959..0c2137f5 100644 --- a/src/lib/Plugin.cpp +++ b/src/lib/Plugin.cpp @@ -39,78 +39,3 @@ void CPlugin::SetSettings(const map_plugin_settings_t& pSettings) } } } - -bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings, - bool skipKeysWithoutValue /*= true*/) -{ - FILE *fp = stdin; - if (strcmp(pPath, "-") != 0) - { - fp = fopen(pPath, "r"); - if (!fp) - return false; - } - - char *line; - while ((line = xmalloc_fgetline(fp)) != NULL) - { - unsigned ii; - bool is_value = false; - bool valid = false; - bool in_quote = false; - std::string key; - std::string value; - for (ii = 0; line[ii] != '\0'; ii++) - { - if (line[ii] == '"') - { - in_quote = !in_quote; - } - if (isspace(line[ii]) && !in_quote) - { - continue; - } - if (line[ii] == '#' && !in_quote && key == "") - { - break; - } - if (line[ii] == '=' && !in_quote) - { - is_value = true; - valid = true; - continue; - } - if (!is_value) - { - key += line[ii]; - } - else - { - value += line[ii]; - } - } - - /* Skip broken or empty lines. */ - if (!valid) - goto free_line; - - /* Skip lines with empty key. */ - if (key.length() == 0) - goto free_line; - - if (skipKeysWithoutValue && value.length() == 0) - goto free_line; - - /* Skip lines with unclosed quotes. */ - if (in_quote) - goto free_line; - - pSettings[key] = value; - free_line: - free(line); - } - - if (fp != stdin) - fclose(fp); - return true; -} diff --git a/src/lib/abrt_packages.c b/src/lib/abrt_packages.c deleted file mode 100644 index bbf0e729..00000000 --- a/src/lib/abrt_packages.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 RedHat Inc - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#include "abrtlib.h" - -/* cuts the name from the NVR format: foo-1.2.3-1.el6 - returns a newly allocated string -*/ -char* get_package_name_from_NVR_or_NULL(const char* packageNVR) -{ - char* package_name = NULL; - if (packageNVR != NULL) - { - VERB1 log("packageNVR %s", packageNVR); - package_name = xstrdup(packageNVR); - char *pos = strrchr(package_name, '-'); - if (pos != NULL) - { - *pos = 0; - pos = strrchr(package_name, '-'); - if (pos != NULL) - { - *pos = 0; - } - } - } - return package_name; -} diff --git a/src/lib/abrt_packages.h b/src/lib/abrt_packages.h deleted file mode 100644 index 6a952f5e..00000000 --- a/src/lib/abrt_packages.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 RedHat Inc - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifndef ABRT_PACKAGES_H -#define ABRT_PACKAGES_H - -#ifdef __cplusplus -extern "C" { -#endif - -char* get_package_name_from_NVR_or_NULL(const char* packageNVR); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/daemon.c b/src/lib/daemon.c deleted file mode 100644 index 944aef0c..00000000 --- a/src/lib/daemon.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2009 RedHat inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#include "abrtlib.h" - -#define VAR_RUN_PID_FILE VAR_RUN"/abrtd.pid" - -static char *append_escaped(char *start, const char *s) -{ - char hex_char_buf[] = "\\x00"; - - *start++ = ' '; - char *dst = start; - const unsigned char *p = (unsigned char *)s; - - while (1) - { - const unsigned char *old_p = p; - while (*p > ' ' && *p <= 0x7e && *p != '\"' && *p != '\'' && *p != '\\') - p++; - if (dst == start) - { - if (p != (unsigned char *)s && *p == '\0') - { - /* entire word does not need escaping and quoting */ - strcpy(dst, s); - dst += strlen(s); - return dst; - } - *dst++ = '\''; - } - - strncpy(dst, (char *)old_p, (p - old_p)); - dst += (p - old_p); - - if (*p == '\0') - { - *dst++ = '\''; - *dst = '\0'; - return dst; - } - const char *a; - switch (*p) - { - case '\r': a = "\\r"; break; - case '\n': a = "\\n"; break; - case '\t': a = "\\t"; break; - case '\'': a = "\\\'"; break; - case '\"': a = "\\\""; break; - case '\\': a = "\\\\"; break; - case ' ': a = " "; break; - default: - hex_char_buf[2] = "0123456789abcdef"[*p >> 4]; - hex_char_buf[3] = "0123456789abcdef"[*p & 0xf]; - a = hex_char_buf; - } - strcpy(dst, a); - dst += strlen(a); - p++; - } -} - -// taken from kernel -#define COMMAND_LINE_SIZE 2048 -char* get_cmdline(pid_t pid) -{ - char path[sizeof("/proc/%lu/cmdline") + sizeof(long)*3]; - char cmdline[COMMAND_LINE_SIZE]; - char escaped_cmdline[COMMAND_LINE_SIZE*4 + 4]; - - escaped_cmdline[1] = '\0'; - sprintf(path, "/proc/%lu/cmdline", (long)pid); - int fd = open(path, O_RDONLY); - if (fd >= 0) - { - int len = read(fd, cmdline, sizeof(cmdline) - 1); - close(fd); - - if (len > 0) - { - cmdline[len] = '\0'; - char *src = cmdline; - char *dst = escaped_cmdline; - while ((src - cmdline) < len) - { - dst = append_escaped(dst, src); - src += strlen(src) + 1; - } - } - } - - return xstrdup(escaped_cmdline + 1); /* +1 skips extraneous leading space */ -} - -int daemon_is_ok() -{ - int fd = open(VAR_RUN_PID_FILE, O_RDONLY); - if (fd < 0) - { - return 0; - } - - char pid[sizeof(pid_t)*3 + 2]; - int len = read(fd, pid, sizeof(pid)-1); - close(fd); - if (len <= 0) - return 0; - - pid[len] = '\0'; - *strchrnul(pid, '\n') = '\0'; - /* paranoia: we don't want to check /proc//stat or /proc///stat */ - if (pid[0] == '\0' || pid[0] == '/') - return 0; - - /* TODO: maybe readlink and check that it is "xxx/abrt"? */ - char path[sizeof("/proc/%s/stat") + sizeof(pid)]; - sprintf(path, "/proc/%s/stat", pid); - struct stat sb; - if (stat(path, &sb) == -1) - { - return 0; - } - - return 1; -} diff --git a/src/lib/daemon_is_ok.c b/src/lib/daemon_is_ok.c new file mode 100644 index 00000000..dc1e94c9 --- /dev/null +++ b/src/lib/daemon_is_ok.c @@ -0,0 +1,51 @@ +/* + Copyright (C) 2009 RedHat inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#include "abrtlib.h" + +int daemon_is_ok() +{ + int fd = open(VAR_RUN"/abrtd.pid", O_RDONLY); + if (fd < 0) + { + return 0; + } + + char pid[sizeof(pid_t)*3 + 2]; + int len = read(fd, pid, sizeof(pid)-1); + close(fd); + if (len <= 0) + return 0; + + pid[len] = '\0'; + *strchrnul(pid, '\n') = '\0'; + /* paranoia: we don't want to check /proc//stat or /proc///stat */ + if (pid[0] == '\0' || pid[0] == '/') + return 0; + + char path[sizeof("/proc/%s/stat") + sizeof(pid)]; + sprintf(path, "/proc/%s/stat", pid); + struct stat sb; + if (stat(path, &sb) == -1) + { + return 0; + } + + /* TODO: maybe readlink /proc/PID/exe and check that it is "xxx/abrt"? */ + + return 1; +} diff --git a/src/lib/get_cmdline.c b/src/lib/get_cmdline.c new file mode 100644 index 00000000..9855eb3c --- /dev/null +++ b/src/lib/get_cmdline.c @@ -0,0 +1,105 @@ +/* + Copyright (C) 2009 RedHat inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#include "abrtlib.h" + +static char *append_escaped(char *start, const char *s) +{ + char hex_char_buf[] = "\\x00"; + + *start++ = ' '; + char *dst = start; + const unsigned char *p = (unsigned char *)s; + + while (1) + { + const unsigned char *old_p = p; + while (*p > ' ' && *p <= 0x7e && *p != '\"' && *p != '\'' && *p != '\\') + p++; + if (dst == start) + { + if (p != (unsigned char *)s && *p == '\0') + { + /* entire word does not need escaping and quoting */ + strcpy(dst, s); + dst += strlen(s); + return dst; + } + *dst++ = '\''; + } + + strncpy(dst, (char *)old_p, (p - old_p)); + dst += (p - old_p); + + if (*p == '\0') + { + *dst++ = '\''; + *dst = '\0'; + return dst; + } + const char *a; + switch (*p) + { + case '\r': a = "\\r"; break; + case '\n': a = "\\n"; break; + case '\t': a = "\\t"; break; + case '\'': a = "\\\'"; break; + case '\"': a = "\\\""; break; + case '\\': a = "\\\\"; break; + case ' ': a = " "; break; + default: + hex_char_buf[2] = "0123456789abcdef"[*p >> 4]; + hex_char_buf[3] = "0123456789abcdef"[*p & 0xf]; + a = hex_char_buf; + } + strcpy(dst, a); + dst += strlen(a); + p++; + } +} + +// taken from kernel +#define COMMAND_LINE_SIZE 2048 +char* get_cmdline(pid_t pid) +{ + char path[sizeof("/proc/%lu/cmdline") + sizeof(long)*3]; + char cmdline[COMMAND_LINE_SIZE]; + char escaped_cmdline[COMMAND_LINE_SIZE*4 + 4]; + + escaped_cmdline[1] = '\0'; + sprintf(path, "/proc/%lu/cmdline", (long)pid); + int fd = open(path, O_RDONLY); + if (fd >= 0) + { + int len = read(fd, cmdline, sizeof(cmdline) - 1); + close(fd); + + if (len > 0) + { + cmdline[len] = '\0'; + char *src = cmdline; + char *dst = escaped_cmdline; + while ((src - cmdline) < len) + { + dst = append_escaped(dst, src); + src += strlen(src) + 1; + } + } + } + + return xstrdup(escaped_cmdline + 1); /* +1 skips extraneous leading space */ +} diff --git a/src/lib/load_plugin_settings.cpp b/src/lib/load_plugin_settings.cpp new file mode 100644 index 00000000..1052f19e --- /dev/null +++ b/src/lib/load_plugin_settings.cpp @@ -0,0 +1,94 @@ +/* + Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) + Copyright (C) 2009 RedHat inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#include "abrtlib.h" + +bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings, + bool skipKeysWithoutValue /*= true*/) +{ + FILE *fp = stdin; + if (strcmp(pPath, "-") != 0) + { + fp = fopen(pPath, "r"); + if (!fp) + return false; + } + + char *line; + while ((line = xmalloc_fgetline(fp)) != NULL) + { + unsigned ii; + bool is_value = false; + bool valid = false; + bool in_quote = false; + std::string key; + std::string value; + for (ii = 0; line[ii] != '\0'; ii++) + { + if (line[ii] == '"') + { + in_quote = !in_quote; + } + if (isspace(line[ii]) && !in_quote) + { + continue; + } + if (line[ii] == '#' && !in_quote && key == "") + { + break; + } + if (line[ii] == '=' && !in_quote) + { + is_value = true; + valid = true; + continue; + } + if (!is_value) + { + key += line[ii]; + } + else + { + value += line[ii]; + } + } + + /* Skip broken or empty lines. */ + if (!valid) + goto free_line; + + /* Skip lines with empty key. */ + if (key.length() == 0) + goto free_line; + + if (skipKeysWithoutValue && value.length() == 0) + goto free_line; + + /* Skip lines with unclosed quotes. */ + if (in_quote) + goto free_line; + + pSettings[key] = value; + free_line: + free(line); + } + + if (fp != stdin) + fclose(fp); + return true; +} diff --git a/src/lib/make_descr.cpp b/src/lib/make_descr.cpp index 90c73667..a0cb5691 100644 --- a/src/lib/make_descr.cpp +++ b/src/lib/make_descr.cpp @@ -75,7 +75,7 @@ static const char *const blacklisted_items[] = { NULL }; -char* make_dsc_mailx(const map_crash_data_t & crash_data) +char* make_description_mailx(const map_crash_data_t & crash_data) { struct strbuf *buf_dsc = strbuf_new(); struct strbuf *buf_additional_files = strbuf_new(); -- cgit