On Thu, Oct 11, 2007 at 12:15:27AM +0200, Enrico Forestieri wrote:
> On Wed, Oct 10, 2007 at 10:03:34PM -0000, [EMAIL PROTECTED] wrote:
> > Author: poenitz
> > Date: Thu Oct 11 00:03:22 2007
> > New Revision: 20891
> > 
> > URL: http://www.lyx.org/trac/changeset/20891
> > Log:
> > thinko
> > 
> > Modified:
> >     lyx-devel/trunk/src/support/environment.cpp
> > 
> > Modified: lyx-devel/trunk/src/support/environment.cpp
> > URL: 
> > http://www.lyx.org/trac/file/lyx-devel/trunk/src/support/environment.cpp?rev=20891
> > ==============================================================================
> > --- lyx-devel/trunk/src/support/environment.cpp (original)
> > +++ lyx-devel/trunk/src/support/environment.cpp Thu Oct 11 00:03:22 2007
> > @@ -60,11 +60,12 @@
> >     // 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 @@
> >     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;
> >  }
> 
> There are systems having both setenv and putenv. Doesn't that mean that,
> for those systems, now both the code for setenv and putenv is compiled
> in, buth the code for putenv gets never executed?

Wouldn't hurt, right?

The unconditional error was worse.

Andre'

Reply via email to