]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgtop: include error cause in log message
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 19 Oct 2018 16:01:31 +0000 (01:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 19 Oct 2018 16:01:31 +0000 (01:01 +0900)
src/cgtop/cgtop.c

index e4123e5f07012dc29745654818ac75eb51ec6910..69a5fde7322f3e67d879f0a9b560537e5611d9f6 100644 (file)
@@ -805,14 +805,16 @@ static int parse_argv(int argc, char *argv[]) {
                 case ARG_DEPTH:
                         r = safe_atou(optarg, &arg_depth);
                         if (r < 0)
-                                return log_error_errno(r, "Failed to parse depth parameter: %s", optarg);
+                                return log_error_errno(r, "Failed to parse depth parameter '%s': %m", optarg);
 
                         break;
 
                 case 'd':
                         r = parse_sec(optarg, &arg_delay);
-                        if (r < 0 || arg_delay <= 0) {
-                                log_error("Failed to parse delay parameter: %s", optarg);
+                        if (r < 0)
+                                return log_error_errno(r, "Failed to parse delay parameter '%s': %m", optarg);
+                        if (arg_delay <= 0) {
+                                log_error("Invalid delay parameter '%s'", optarg);
                                 return -EINVAL;
                         }
 
@@ -821,7 +823,7 @@ static int parse_argv(int argc, char *argv[]) {
                 case 'n':
                         r = safe_atou(optarg, &arg_iterations);
                         if (r < 0)
-                                return log_error_errno(r, "Failed to parse iterations parameter: %s", optarg);
+                                return log_error_errno(r, "Failed to parse iterations parameter '%s': %m", optarg);
 
                         break;
 
@@ -885,7 +887,7 @@ static int parse_argv(int argc, char *argv[]) {
                 case ARG_RECURSIVE:
                         r = parse_boolean(optarg);
                         if (r < 0)
-                                return log_error_errno(r, "Failed to parse --recursive= argument: %s", optarg);
+                                return log_error_errno(r, "Failed to parse --recursive= argument '%s': %m", optarg);
 
                         arg_recursive = r;
                         arg_recursive_unset = r == 0;