1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

bus: use "System.Error." as prefix for implicit errno bus errors

We probably shouldn't use "Posix.Error" since many of the errors have
nothing to do with Posix.
This commit is contained in:
Lennart Poettering 2013-11-30 19:53:33 +01:00
parent 79f8d3d2ce
commit 763e20e675
2 changed files with 7 additions and 7 deletions

View File

@ -42,7 +42,7 @@ static int bus_error_name_to_errno(const char *name) {
if (!name)
return EINVAL;
p = startswith(name, "Posix.Error.");
p = startswith(name, "System.Error.");
if (p) {
r = errno_from_name(p);
if (r <= 0)
@ -198,7 +198,7 @@ static int errno_to_bus_error_name_new(int error, char **ret) {
if (!name)
return 0;
n = strappend("Posix.Error.", name);
n = strappend("System.Error.", name);
if (!n)
return -ENOMEM;

View File

@ -86,19 +86,19 @@ int main(int argc, char *argv[]) {
assert_se(sd_bus_error_is_set(&second));
assert_se(!sd_bus_error_is_set(&error));
assert_se(sd_bus_error_set_const(&error, "Posix.Error.EUCLEAN", "Hallo") == -EUCLEAN);
assert_se(streq(error.name, "Posix.Error.EUCLEAN"));
assert_se(sd_bus_error_set_const(&error, "System.Error.EUCLEAN", "Hallo") == -EUCLEAN);
assert_se(streq(error.name, "System.Error.EUCLEAN"));
assert_se(streq(error.message, "Hallo"));
assert_se(sd_bus_error_has_name(&error, "Posix.Error.EUCLEAN"));
assert_se(sd_bus_error_has_name(&error, "System.Error.EUCLEAN"));
assert_se(sd_bus_error_get_errno(&error) == EUCLEAN);
assert_se(sd_bus_error_is_set(&error));
sd_bus_error_free(&error);
assert_se(!sd_bus_error_is_set(&error));
assert_se(sd_bus_error_set_errno(&error, EBUSY) == -EBUSY);
assert_se(streq(error.name, "Posix.Error.EBUSY"));
assert_se(streq(error.name, "System.Error.EBUSY"));
assert_se(streq(error.message, strerror(EBUSY)));
assert_se(sd_bus_error_has_name(&error, "Posix.Error.EBUSY"));
assert_se(sd_bus_error_has_name(&error, "System.Error.EBUSY"));
assert_se(sd_bus_error_get_errno(&error) == EBUSY);
assert_se(sd_bus_error_is_set(&error));
sd_bus_error_free(&error);