[PATCH 2/3] Weston: compositor.c: Logging to $HOME/weston.log, stderr

Andreas Ericsson ae at op5.se
Sun May 27 11:08:10 PDT 2012


On 05/26/2012 05:40 PM, Martin Minarik wrote:
> Signed-off-by: Martin Minarik<minarik11 at student.fiit.stuba.sk>
> ---
>   src/compositor.c |   10 +++++++++-
>   1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/src/compositor.c b/src/compositor.c
> index 3c1e058..6582e21 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -25,13 +25,13 @@
>   #define _GNU_SOURCE
> 
>   #include "config.h"
> +#include "log.h"
> 
>   #include<stdio.h>
>   #include<string.h>
>   #include<stdlib.h>
>   #include<stdint.h>
>   #include<limits.h>
> -#include<stdarg.h>
>   #include<assert.h>
>   #include<sys/ioctl.h>
>   #include<sys/wait.h>
> @@ -2845,6 +2845,14 @@ int main(int argc, char *argv[])
>   		{ WESTON_OPTION_STRING, "module", 0,&module },
>   	};
> 
> +	if (getenv("HOME")) {
> +		char * logfname = "/weston.log";
> +		char * home = getenv("HOME");
> +		char string[128];


Any reason you're not using either PATH_MAX or a dynamic variable here?
People with $HOME mounted on some horrifying network monster may well
have paths too long for this, and there's no real reason to be stitchy
with memory when it's a onetime thing.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.


More information about the wayland-devel mailing list