aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/App.hh
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-09-17 21:43:24 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-09-17 21:43:24 (GMT)
commit87b45bd0d18323898d5c09bb7cad7566e3267635 (patch)
treef5570d524399e3dab443dde9419af86c3874f416 /src/FbTk/App.hh
parentf3ad09c4ce70cc58871eeac49d640f213f3cd16f (diff)
downloadfluxbox_pavel-87b45bd0d18323898d5c09bb7cad7566e3267635.zip
fluxbox_pavel-87b45bd0d18323898d5c09bb7cad7566e3267635.tar.bz2
bugfix: avoid naive use of 'putenv' by providing 'FbTk::App::setenv()'
to quote from 'man putenv': The string pointed to by string becomes part of the environment, so altering the string changes the environment. so, using putenv like { std::string foo("FOO=bar"); putenv(foo.c_str()); } is wrong and leads to a potentially corrupted environment. valgrind complaint correctly. FbTk::App seems to be the appropriate place to hold '::seten()' because it alters the environment of the application.
Diffstat (limited to 'src/FbTk/App.hh')
-rw-r--r--src/FbTk/App.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/FbTk/App.hh b/src/FbTk/App.hh
index d878661..b83dd15 100644
--- a/src/FbTk/App.hh
+++ b/src/FbTk/App.hh
@@ -53,6 +53,11 @@ public:
53 /// forces an end to event loop 53 /// forces an end to event loop
54 void end(); 54 void end();
55 bool done() const { return m_done; } 55 bool done() const { return m_done; }
56
57 // the setenv()-routine is not everywhere available and
58 // putenv() doesnt manage the strings in the environment
59 // and hence we have to do that on our own to avoid memleaking
60 static bool setenv(const char* key, const char* value);
56private: 61private:
57 static App *s_app; 62 static App *s_app;
58 bool m_done; 63 bool m_done;