You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Charles Reiss <wo...@gmail.com> on 2012/06/19 22:50:09 UTC

Review Request: Pass non-temporary string to InitGoogleLogging

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/5423/
-----------------------------------------------------------

Review request for mesos and Benjamin Hindman.


Description
-------

InitGoogleLogging() assumes that the const char* (for argv[0]) it is passed remains valid indefinitely, but the code in common/logging.cpp passes it a temporary string. This patch uses a static string instead.


Diffs
-----

  src/common/logging.cpp 59ce251 

Diff: https://reviews.apache.org/r/5423/diff/


Testing
-------

make check


Thanks,

Charles Reiss


Re: Review Request: Pass non-temporary string to InitGoogleLogging

Posted by Charles Reiss <wo...@gmail.com>.

> On June 19, 2012, 8:52 p.m., Benjamin Hindman wrote:
> > src/common/logging.cpp, line 59
> > <https://reviews.apache.org/r/5423/diff/2/?file=112244#file112244line59>
> >
> >     Any reason not to do:
> >     
> >     static string argv0 = _argv0;

Not really (though it should probably be moved after the if (initialized.once()), then).


- Charles


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/5423/#review8405
-----------------------------------------------------------


On June 19, 2012, 8:50 p.m., Charles Reiss wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/5423/
> -----------------------------------------------------------
> 
> (Updated June 19, 2012, 8:50 p.m.)
> 
> 
> Review request for mesos and Benjamin Hindman.
> 
> 
> Description
> -------
> 
> InitGoogleLogging() assumes that the const char* (for argv[0]) it is passed remains valid indefinitely, but the code in common/logging.cpp passes it a temporary string. This patch uses a static string instead.
> 
> 
> Diffs
> -----
> 
>   src/common/logging.cpp 59ce251 
> 
> Diff: https://reviews.apache.org/r/5423/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Charles Reiss
> 
>


Re: Review Request: Pass non-temporary string to InitGoogleLogging

Posted by Benjamin Hindman <be...@berkeley.edu>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/5423/#review8405
-----------------------------------------------------------

Ship it!



src/common/logging.cpp
<https://reviews.apache.org/r/5423/#comment18064>

    Any reason not to do:
    
    static string argv0 = _argv0;


- Benjamin Hindman


On June 19, 2012, 8:50 p.m., Charles Reiss wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/5423/
> -----------------------------------------------------------
> 
> (Updated June 19, 2012, 8:50 p.m.)
> 
> 
> Review request for mesos and Benjamin Hindman.
> 
> 
> Description
> -------
> 
> InitGoogleLogging() assumes that the const char* (for argv[0]) it is passed remains valid indefinitely, but the code in common/logging.cpp passes it a temporary string. This patch uses a static string instead.
> 
> 
> Diffs
> -----
> 
>   src/common/logging.cpp 59ce251 
> 
> Diff: https://reviews.apache.org/r/5423/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Charles Reiss
> 
>