summaryrefslogtreecommitdiff
path: root/src/timedate/timedated.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-30 20:32:17 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-30 20:38:28 -0400
commit7358dc029ab8cb8f9d83eb847389d84f822ccfe8 (patch)
treefb119a569229988b8dbf3408794d41ce0e229442 /src/timedate/timedated.c
parent4a0a74179fcfb85c456794fd91fa2ae5d4d3bc8f (diff)
Convert the rest to sd_bus_errnomap
I tried to preserve most errno values, but in some cases they were inconsistent (different errno values for the same error name) or just mismatched.
Diffstat (limited to 'src/timedate/timedated.c')
-rw-r--r--src/timedate/timedated.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 8880812b49..49a957c8d0 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -44,6 +44,10 @@
#define NULL_ADJTIME_UTC "0.0 0 0\n0\nUTC\n"
#define NULL_ADJTIME_LOCAL "0.0 0 0\n0\nLOCAL\n"
+SD_BUS_ERROR_MAPPING = {
+ {"org.freedesktop.timedate1.NoNTPSupport", ENOTSUP},
+};
+
typedef struct Context {
char *zone;
bool local_rtc;
@@ -254,10 +258,8 @@ static int context_start_ntp(Context *c, sd_bus *bus, sd_bus_error *error) {
if (r < 0) {
if (sd_bus_error_has_name(error, SD_BUS_ERROR_FILE_NOT_FOUND) ||
sd_bus_error_has_name(error, "org.freedesktop.systemd1.LoadFailed") ||
- sd_bus_error_has_name(error, "org.freedesktop.systemd1.NoSuchUnit")) {
- sd_bus_error_set_const(error, "org.freedesktop.timedate1.NoNTPSupport", "NTP not supported.");
- return -ENOTSUP;
- }
+ sd_bus_error_has_name(error, "org.freedesktop.systemd1.NoSuchUnit"))
+ return sd_bus_error_set_const(error, "org.freedesktop.timedate1.NoNTPSupport", "NTP not supported.");
return r;
}
@@ -298,10 +300,8 @@ static int context_enable_ntp(Context*c, sd_bus *bus, sd_bus_error *error) {
false);
if (r < 0) {
- if (sd_bus_error_has_name(error, SD_BUS_ERROR_FILE_NOT_FOUND)) {
- sd_bus_error_set_const(error, "org.freedesktop.timedate1.NoNTPSupport", "NTP not supported.");
- return -ENOTSUP;
- }
+ if (sd_bus_error_has_name(error, SD_BUS_ERROR_FILE_NOT_FOUND))
+ return sd_bus_error_set_const(error, "org.freedesktop.timedate1.NoNTPSupport", "NTP not supported.");
return r;
}