<div dir="ltr">Disregard this patch, I sent in another that should handle better the config file issues.<div><br></div><div>Alex</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Sep 25, 2013 at 11:23 PM, Damian, Alexandru <span dir="ltr"><<a href="mailto:alexandru.damian@intel.com" target="_blank">alexandru.damian@intel.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>The nice thing was that even if some other code besides the _log tries to read the file path, that code can expect to open the path and read from it just fine, instead of receiving a NULL and maybe crashing.<br>
<br></div>I'm gonna check tomorrow if this happens somewhere else in the code, and if not, modify _full_path to return NULL and change the log message.<br></div><div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">
On Wed, Sep 25, 2013 at 9:43 PM, Kristian Høgsberg <span dir="ltr"><<a href="mailto:krh@bitplanet.net" target="_blank">krh@bitplanet.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Wed, Sep 25, 2013 at 11:07 AM, Alex DAMIAN<br>
<<a href="mailto:alexandru.damian@intel.com" target="_blank">alexandru.damian@intel.com</a>> wrote:<br>
> From: Alexandru DAMIAN <<a href="mailto:alexandru.damian@intel.com" target="_blank">alexandru.damian@intel.com</a>><br>
><br>
> weston_config_parse may return NULL,<br>
> leading to an ungraceful exit via SIGSEGV if we<br>
> try to reference the structure.<br>
><br>
> Adding a check in weston_config_full_path so that<br>
> we return the empty file /dev/null as filename<br>
> if we started without a config file.<br>
<br>
</div>I think it's ok for weston_config_get_full_path() to crash if passed a<br>
NULL pointer. Returning /dev/null or anything else is a little odd.<br>
Maybe returning NULL would be ok, but I think we can just have an if<br>
statement and log "No config file found" if config is NULL, and log<br>
the file name if we did get a config.<br>
<span><font color="#888888"><br>
Kristian<br>
</font></span><div><br>
> Signed-off-by: Alexandru DAMIAN <<a href="mailto:alexandru.damian@intel.com" target="_blank">alexandru.damian@intel.com</a>><br>
> ---<br>
> shared/config-parser.c | 2 +-<br>
> src/compositor.c | 1 +<br>
> 2 files changed, 2 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/shared/config-parser.c b/shared/config-parser.c<br>
> index e1bf212..ef5c5b9 100644<br>
> --- a/shared/config-parser.c<br>
> +++ b/shared/config-parser.c<br>
> @@ -385,7 +385,7 @@ weston_config_parse(const char *name)<br>
> const char *<br>
> weston_config_get_full_path(struct weston_config *config)<br>
> {<br>
> - return config->path;<br>
> + return config == NULL ? "/dev/null" : config->path;<br>
> }<br>
><br>
> int<br>
> 1.8.1.2<br>
><br>
</div><div><div>> _______________________________________________<br>
> wayland-devel mailing list<br>
> <a href="mailto:wayland-devel@lists.freedesktop.org" target="_blank">wayland-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><span class="HOEnZb"><font color="#888888">-- <br><div dir="ltr">Alex Damian<div>Yocto Project<br></div><div>SSG / OTC </div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Alex Damian<div>Yocto Project<br></div><div>SSG / OTC </div></div>
</div>