]> git.lyx.org Git - lyx.git/commitdiff
thinko
authorAndré Pönitz <poenitz@gmx.net>
Wed, 10 Oct 2007 22:03:22 +0000 (22:03 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 10 Oct 2007 22:03:22 +0000 (22:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20891 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/environment.cpp

index 8f83022378a7989511417cae28c3c37cf3ddb890..e3469f1fa3169dbac2e62471b5694a628d773e53 100644 (file)
@@ -60,11 +60,12 @@ bool setEnv(string const & name, string const & value)
        // CHECK Look at and fix this.
        // f.ex. what about error checking?
 
-       string const encoded(to_local8bit(from_utf8(value)));
+       string const encoded = to_local8bit(from_utf8(value));
 #if defined (HAVE_SETENV)
-       int const retval = ::setenv(name.c_str(), encoded.c_str(), true);
+       return ::setenv(name.c_str(), encoded.c_str(), true) == 0;
+#endif
 
-#elif defined (HAVE_PUTENV)
+#if defined (HAVE_PUTENV)
        static std::map<string, char *> varmap;
 
        string envstr = name + '=' + encoded;
@@ -77,11 +78,13 @@ bool setEnv(string const & name, string const & value)
        if (oldptr)
                delete oldptr;
        varmap[name] = newptr;
+       return retval == 0;
+#endif
 
-#else
+#if !(defined HAVE_SETENV) && !(defined HAVE_PUTENV)
 #error No environment-setting function has been defined.
 #endif
-       return retval == 0;
+       return false;
 }