Disregard this patch, I sent in another that should handle better the config file issues.
Alex On Wed, Sep 25, 2013 at 11:23 PM, Damian, Alexandru < alexandru.dam...@intel.com> wrote: > 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. > > 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. > > > On Wed, Sep 25, 2013 at 9:43 PM, Kristian Høgsberg <k...@bitplanet.net>wrote: > >> On Wed, Sep 25, 2013 at 11:07 AM, Alex DAMIAN >> <alexandru.dam...@intel.com> wrote: >> > From: Alexandru DAMIAN <alexandru.dam...@intel.com> >> > >> > weston_config_parse may return NULL, >> > leading to an ungraceful exit via SIGSEGV if we >> > try to reference the structure. >> > >> > Adding a check in weston_config_full_path so that >> > we return the empty file /dev/null as filename >> > if we started without a config file. >> >> I think it's ok for weston_config_get_full_path() to crash if passed a >> NULL pointer. Returning /dev/null or anything else is a little odd. >> Maybe returning NULL would be ok, but I think we can just have an if >> statement and log "No config file found" if config is NULL, and log >> the file name if we did get a config. >> >> Kristian >> >> > Signed-off-by: Alexandru DAMIAN <alexandru.dam...@intel.com> >> > --- >> > shared/config-parser.c | 2 +- >> > src/compositor.c | 1 + >> > 2 files changed, 2 insertions(+), 1 deletion(-) >> > >> > diff --git a/shared/config-parser.c b/shared/config-parser.c >> > index e1bf212..ef5c5b9 100644 >> > --- a/shared/config-parser.c >> > +++ b/shared/config-parser.c >> > @@ -385,7 +385,7 @@ weston_config_parse(const char *name) >> > const char * >> > weston_config_get_full_path(struct weston_config *config) >> > { >> > - return config->path; >> > + return config == NULL ? "/dev/null" : config->path; >> > } >> > >> > int >> > 1.8.1.2 >> > >> > _______________________________________________ >> > wayland-devel mailing list >> > wayland-devel@lists.freedesktop.org >> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel >> > > > > -- > Alex Damian > Yocto Project > SSG / OTC > -- Alex Damian Yocto Project SSG / OTC
_______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel