summaryrefslogtreecommitdiffstats
path: root/src/include/xfuncs.h
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-03-07 21:49:51 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2011-03-07 21:49:51 +0100
commitef47609ab73ba222e0ef9f2da51dca4650af69d8 (patch)
tree9380193e3c4b561b1731ee3249c42e6b2660a7e5 /src/include/xfuncs.h
parent5b06fcaf6ebd375f939d510bbfe3933ef8ab2156 (diff)
downloadabrt-ef47609ab73ba222e0ef9f2da51dca4650af69d8.tar.gz
abrt-ef47609ab73ba222e0ef9f2da51dca4650af69d8.tar.xz
abrt-ef47609ab73ba222e0ef9f2da51dca4650af69d8.zip
gui-wizard-gtk: add code to export/unexport config variables. Untested
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/include/xfuncs.h')
-rw-r--r--src/include/xfuncs.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/include/xfuncs.h b/src/include/xfuncs.h
index 61188c81..5f2504b6 100644
--- a/src/include/xfuncs.h
+++ b/src/include/xfuncs.h
@@ -74,6 +74,19 @@ char* xasprintf(const char *format, ...);
#define xsetenv abrt_xsetenv
void xsetenv(const char *key, const char *value);
+/*
+ * Utility function to unsetenv a string which was possibly putenv'ed.
+ * The problem here is that "natural" optimization:
+ * strchrnul(var_val, '=')[0] = '\0';
+ * unsetenv(var_val);
+ * is BUGGY: if string was put into environment via putenv,
+ * its modification (s/=/NUL/) is illegal, and unsetenv will fail to unset it.
+ * Of course, saving/restoring the char wouldn't work either.
+ * This helper creates a copy up to '=', unsetenv's it, and frees:
+ */
+#define safe_unsetenv abrt_safe_unsetenv
+void safe_unsetenv(const char *var_val);
+
#define xsocket abrt_xsocket
int xsocket(int domain, int type, int protocol);
#define xbind abrt_xbind