mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 02:21:44 +03:00
busctl: include error cause in log message
This commit is contained in:
parent
7709ef3a70
commit
3d9942de4f
@ -1356,7 +1356,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = parse_boolean(v);
|
r = parse_boolean(v);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse as boolean: %s", v);
|
return log_error_errno(r, "Failed to parse '%s' as boolean: %m", v);
|
||||||
|
|
||||||
r = sd_bus_message_append_basic(m, t, &r);
|
r = sd_bus_message_append_basic(m, t, &r);
|
||||||
break;
|
break;
|
||||||
@ -1366,7 +1366,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = safe_atou8(v, &z);
|
r = safe_atou8(v, &z);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse as byte (unsigned 8bit integer): %s", v);
|
return log_error_errno(r, "Failed to parse '%s' as byte (unsigned 8bit integer): %m", v);
|
||||||
|
|
||||||
r = sd_bus_message_append_basic(m, t, &z);
|
r = sd_bus_message_append_basic(m, t, &z);
|
||||||
break;
|
break;
|
||||||
@ -1377,7 +1377,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = safe_atoi16(v, &z);
|
r = safe_atoi16(v, &z);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse as signed 16bit integer: %s", v);
|
return log_error_errno(r, "Failed to parse '%s' as signed 16bit integer: %m", v);
|
||||||
|
|
||||||
r = sd_bus_message_append_basic(m, t, &z);
|
r = sd_bus_message_append_basic(m, t, &z);
|
||||||
break;
|
break;
|
||||||
@ -1388,7 +1388,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = safe_atou16(v, &z);
|
r = safe_atou16(v, &z);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse as unsigned 16bit integer: %s", v);
|
return log_error_errno(r, "Failed to parse '%s' as unsigned 16bit integer: %m", v);
|
||||||
|
|
||||||
r = sd_bus_message_append_basic(m, t, &z);
|
r = sd_bus_message_append_basic(m, t, &z);
|
||||||
break;
|
break;
|
||||||
@ -1399,7 +1399,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = safe_atoi32(v, &z);
|
r = safe_atoi32(v, &z);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse as signed 32bit integer: %s", v);
|
return log_error_errno(r, "Failed to parse '%s' as signed 32bit integer: %m", v);
|
||||||
|
|
||||||
r = sd_bus_message_append_basic(m, t, &z);
|
r = sd_bus_message_append_basic(m, t, &z);
|
||||||
break;
|
break;
|
||||||
@ -1410,7 +1410,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = safe_atou32(v, &z);
|
r = safe_atou32(v, &z);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse as unsigned 32bit integer: %s", v);
|
return log_error_errno(r, "Failed to parse '%s' as unsigned 32bit integer: %m", v);
|
||||||
|
|
||||||
r = sd_bus_message_append_basic(m, t, &z);
|
r = sd_bus_message_append_basic(m, t, &z);
|
||||||
break;
|
break;
|
||||||
@ -1421,7 +1421,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = safe_atoi64(v, &z);
|
r = safe_atoi64(v, &z);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse as signed 64bit integer: %s", v);
|
return log_error_errno(r, "Failed to parse '%s' as signed 64bit integer: %m", v);
|
||||||
|
|
||||||
r = sd_bus_message_append_basic(m, t, &z);
|
r = sd_bus_message_append_basic(m, t, &z);
|
||||||
break;
|
break;
|
||||||
@ -1432,7 +1432,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = safe_atou64(v, &z);
|
r = safe_atou64(v, &z);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse as unsigned 64bit integer: %s", v);
|
return log_error_errno(r, "Failed to parse '%s' as unsigned 64bit integer: %m", v);
|
||||||
|
|
||||||
r = sd_bus_message_append_basic(m, t, &z);
|
r = sd_bus_message_append_basic(m, t, &z);
|
||||||
break;
|
break;
|
||||||
@ -1443,7 +1443,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = safe_atod(v, &z);
|
r = safe_atod(v, &z);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse as double precision floating point: %s", v);
|
return log_error_errno(r, "Failed to parse '%s' as double precision floating point: %m", v);
|
||||||
|
|
||||||
r = sd_bus_message_append_basic(m, t, &z);
|
r = sd_bus_message_append_basic(m, t, &z);
|
||||||
break;
|
break;
|
||||||
@ -1462,11 +1462,11 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = safe_atou32(v, &n);
|
r = safe_atou32(v, &n);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse number of array entries: %s", v);
|
return log_error_errno(r, "Failed to parse '%s' number of array entries: %m", v);
|
||||||
|
|
||||||
r = signature_element_length(signature, &k);
|
r = signature_element_length(signature, &k);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Invalid array signature.");
|
return log_error_errno(r, "Invalid array signature: %m");
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -1512,7 +1512,7 @@ static int message_append_cmdline(sd_bus_message *m, const char *signature, char
|
|||||||
|
|
||||||
r = signature_element_length(signature, &k);
|
r = signature_element_length(signature, &k);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Invalid struct/dict entry signature.");
|
return log_error_errno(r, "Invalid struct/dict entry signature: %m");
|
||||||
|
|
||||||
{
|
{
|
||||||
char s[k-1];
|
char s[k-1];
|
||||||
@ -2285,7 +2285,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
|
|
||||||
r = parse_size(optarg, 1024, &sz);
|
r = parse_size(optarg, 1024, &sz);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse size: %s", optarg);
|
return log_error_errno(r, "Failed to parse size '%s': %m", optarg);
|
||||||
|
|
||||||
if ((uint64_t) (size_t) sz != sz) {
|
if ((uint64_t) (size_t) sz != sz) {
|
||||||
log_error("Size out of range.");
|
log_error("Size out of range.");
|
||||||
@ -2321,7 +2321,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
case ARG_EXPECT_REPLY:
|
case ARG_EXPECT_REPLY:
|
||||||
r = parse_boolean(optarg);
|
r = parse_boolean(optarg);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse --expect-reply= parameter: %s", optarg);
|
return log_error_errno(r, "Failed to parse --expect-reply= parameter '%s': %m", optarg);
|
||||||
|
|
||||||
arg_expect_reply = r;
|
arg_expect_reply = r;
|
||||||
break;
|
break;
|
||||||
@ -2329,7 +2329,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
case ARG_AUTO_START:
|
case ARG_AUTO_START:
|
||||||
r = parse_boolean(optarg);
|
r = parse_boolean(optarg);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse --auto-start= parameter: %s", optarg);
|
return log_error_errno(r, "Failed to parse --auto-start= parameter '%s': %m", optarg);
|
||||||
|
|
||||||
arg_auto_start = r;
|
arg_auto_start = r;
|
||||||
break;
|
break;
|
||||||
@ -2337,7 +2337,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
case ARG_ALLOW_INTERACTIVE_AUTHORIZATION:
|
case ARG_ALLOW_INTERACTIVE_AUTHORIZATION:
|
||||||
r = parse_boolean(optarg);
|
r = parse_boolean(optarg);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse --allow-interactive-authorization= parameter: %s", optarg);
|
return log_error_errno(r, "Failed to parse --allow-interactive-authorization= parameter '%s': %m", optarg);
|
||||||
|
|
||||||
arg_allow_interactive_authorization = r;
|
arg_allow_interactive_authorization = r;
|
||||||
break;
|
break;
|
||||||
@ -2345,14 +2345,14 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
case ARG_TIMEOUT:
|
case ARG_TIMEOUT:
|
||||||
r = parse_sec(optarg, &arg_timeout);
|
r = parse_sec(optarg, &arg_timeout);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse --timeout= parameter: %s", optarg);
|
return log_error_errno(r, "Failed to parse --timeout= parameter '%s': %m", optarg);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ARG_AUGMENT_CREDS:
|
case ARG_AUGMENT_CREDS:
|
||||||
r = parse_boolean(optarg);
|
r = parse_boolean(optarg);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse --augment-creds= parameter: %s", optarg);
|
return log_error_errno(r, "Failed to parse --augment-creds= parameter '%s': %m", optarg);
|
||||||
|
|
||||||
arg_augment_creds = r;
|
arg_augment_creds = r;
|
||||||
break;
|
break;
|
||||||
@ -2360,7 +2360,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
case ARG_WATCH_BIND:
|
case ARG_WATCH_BIND:
|
||||||
r = parse_boolean(optarg);
|
r = parse_boolean(optarg);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to parse --watch-bind= parameter: %s", optarg);
|
return log_error_errno(r, "Failed to parse --watch-bind= parameter '%s': %m", optarg);
|
||||||
|
|
||||||
arg_watch_bind = r;
|
arg_watch_bind = r;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user