[systemd-devel] [PATCH] use "Out of memory." consistantly (or with "\n")

Lennart Poettering lennart at poettering.net
Wed Aug 8 10:02:59 PDT 2012


On Mon, 06.08.12 11:43, shawn (shawnlandden at gmail.com) wrote:

> -                case '?':
> -                        return -EINVAL;
> -
>                  default:
> -                        log_error("Unknown option code %c", c);
> +                        log_error("Unknown option code '%c'", c);
>                          return -EINVAL;
>                  }

Hmm, but this would result in one message by getopt() itself and one by
us in case the user uses an unknown switch, no?

I'd like to turn off that getopt() internal message, but I am not sure
there is a way....

>          }
> @@ -664,8 +661,10 @@ int main(int argc, char *argv[]) {
>                  if (t >= last_refresh + arg_delay || immediate_refresh) {
>  
>                          r = refresh(a, b, iteration++);
> -                        if (r < 0)
> +                        if (r < 0) {
> +                                log_error("Failed to refresh cgroup data: %s", strerror(-r));
>                                  goto finish;
> +                        }
>  
>                          group_hashmap_clear(b);
>  
> @@ -782,10 +781,5 @@ finish:
>          group_hashmap_free(a);
>          group_hashmap_free(b);
>  
> -        if (r < 0) {
> -                log_error("Exiting with failure: %s", strerror(-r));
> -                return EXIT_FAILURE;
> -        }
> -
> -        return EXIT_SUCCESS;
> +        return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
>  }



Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list