diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-05 19:04:44 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-05 19:04:44 +0200 |
commit | 8336bbee624aa84b485e3f6b0984bce04b52e61d (patch) | |
tree | 7bd7ad50971d9029265bdc5cf03d2963c017326e /lib/Utils | |
parent | 35d4ceb1fa329e2adba6af29cde8cb1a805522c1 (diff) | |
download | abrt-8336bbee624aa84b485e3f6b0984bce04b52e61d.tar.gz abrt-8336bbee624aa84b485e3f6b0984bce04b52e61d.tar.xz abrt-8336bbee624aa84b485e3f6b0984bce04b52e61d.zip |
Hooks/CCpp.cpp: don't dump executables with "/abrt" substring in the name
some cleanups and abrtlib work crept in too...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils')
-rw-r--r-- | lib/Utils/xfuncs.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/Utils/xfuncs.cpp b/lib/Utils/xfuncs.cpp index ad67ec62..078c8045 100644 --- a/lib/Utils/xfuncs.cpp +++ b/lib/Utils/xfuncs.cpp @@ -158,6 +158,35 @@ char* xasprintf(const char *format, ...) return string_ptr; } +std::string ssprintf(const char *format, ...) +{ + va_list p; + int r; + char *string_ptr; + +#if 1 + // GNU extension + va_start(p, format); + r = vasprintf(&string_ptr, format, p); + va_end(p); +#else + // Bloat for systems that haven't got the GNU extension. + va_start(p, format); + r = vsnprintf(NULL, 0, format, p); + va_end(p); + string_ptr = xmalloc(r+1); + va_start(p, format); + r = vsnprintf(string_ptr, r+1, format, p); + va_end(p); +#endif + + if (r < 0) + error_msg_and_die(msg_memory_exhausted); + std::string res = string_ptr; + free(string_ptr); + return res; +} + void xsetenv(const char *key, const char *value) { if (setenv(key, value, 1)) @@ -170,7 +199,6 @@ int xsocket(int domain, int type, int protocol) int r = socket(domain, type, protocol); if (r < 0) { - /* Hijack vaguely related config option */ const char *s = "INET"; if (domain == AF_PACKET) s = "PACKET"; if (domain == AF_NETLINK) s = "NETLINK"; |