[systemd-devel] [PATCH] bootchart: Use os-release, not system-release

Lennart Poettering lennart at poettering.net
Wed Feb 13 10:21:42 PST 2013


On Wed, 13.02.13 11:37, William Giokas (1007380 at gmail.com) wrote:

> os-release is required for systemd now, so use that file and stop
> printing 'Unknown' on the bootchart.

Actually, this code should probably use load_env_file() instead anyway...

> ---
>  src/bootchart/svg.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
> index d7c4168..ec81da9 100644
> --- a/src/bootchart/svg.c
> +++ b/src/bootchart/svg.c
> @@ -195,11 +195,15 @@ static void svg_title(void)
>                  fclose(f);
>          }
>  
> -        /* Build - 1st line from /etc/system-release */
> -        f = fopen("/etc/system-release", "r");
> +        /* Build - NAME line from /etc/os-release */
> +        f = fopen("/etc/os-release", "r");
>          if (f) {
> -                if (fgets(buf, 255, f))
> -                        strncpy(build, buf, 255);
> +                while (fgets(buf, 255, f)) {
> +                        if (strstr(buf, "NAME=")) {
> +                                strncpy(build, &buf[5], 255);
> +                                break;
> +                        }
> +                }
>                  fclose(f);
>          }
>  


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list