Compare commits
No commits in common. "e243dd0b12566ecf04a93b3fa0ab55404c2f7565" and "d5c7a0413a655a70c6f13822fa76159d0e781351" have entirely different histories.
e243dd0b12
...
d5c7a0413a
BIN
timedatex-0.5.tar.gz
Normal file
BIN
timedatex-0.5.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
66
timedatex-timeout.patch
Normal file
66
timedatex-timeout.patch
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
commit 3f0b85db1d4eedd3fdc9db0832e114215812d15c
|
||||||
|
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
||||||
|
Date: Wed Jan 10 15:55:05 2018 +0100
|
||||||
|
|
||||||
|
don't remove timeout after each main context iteration
|
||||||
|
|
||||||
|
With glib2-2.54.3 adding a new timeout causes g_main_context_iteration()
|
||||||
|
to immediately return FALSE, which triggered an infinite loop removing
|
||||||
|
and adding the timeout.
|
||||||
|
|
||||||
|
Instead of removing the timeout after all iterations, use a flag to
|
||||||
|
remove the timeout only when a valid call was handled.
|
||||||
|
|
||||||
|
This fixes issue #4.
|
||||||
|
|
||||||
|
diff --git a/timedatex.c b/timedatex.c
|
||||||
|
index 28e562c..e671bb5 100644
|
||||||
|
--- a/timedatex.c
|
||||||
|
+++ b/timedatex.c
|
||||||
|
@@ -120,7 +120,7 @@ struct hwclock_call {
|
||||||
|
|
||||||
|
/* Global variables */
|
||||||
|
static GDBusProxy *systemd_proxy, *polkit_proxy;
|
||||||
|
-static gboolean main_quit, running_auth_checks;
|
||||||
|
+static gboolean main_quit, running_auth_checks, had_activity;
|
||||||
|
static GArray *ntp_units;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -948,6 +948,8 @@ static void handle_method_call(GDBusConnection *connection, const gchar *caller,
|
||||||
|
} else {
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ had_activity = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const GDBusInterfaceVTable interface_vtable = {
|
||||||
|
@@ -1022,19 +1024,24 @@ int main(int argc, char **argv) {
|
||||||
|
read_ntp_units();
|
||||||
|
|
||||||
|
main_quit = FALSE;
|
||||||
|
+ had_activity = FALSE;
|
||||||
|
|
||||||
|
/* This is the main loop. Quit when idle for QUIT_TIMEOUT seconds. */
|
||||||
|
|
||||||
|
while (!main_quit) {
|
||||||
|
/* Add timeout when not waiting for an authorization check */
|
||||||
|
- if (!running_auth_checks)
|
||||||
|
+ if (!timeout_id && !running_auth_checks)
|
||||||
|
timeout_id = g_timeout_add(QUIT_TIMEOUT * 1000, stop_main_loop, NULL);
|
||||||
|
|
||||||
|
g_main_context_iteration(g_main_context_default(), TRUE);
|
||||||
|
|
||||||
|
- if (timeout_id)
|
||||||
|
- g_source_remove(timeout_id);
|
||||||
|
- timeout_id = 0;
|
||||||
|
+ if (had_activity || running_auth_checks) {
|
||||||
|
+ had_activity = FALSE;
|
||||||
|
+
|
||||||
|
+ if (timeout_id)
|
||||||
|
+ g_source_remove(timeout_id);
|
||||||
|
+ timeout_id = 0;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
@ -1,16 +1,18 @@
|
|||||||
%global _hardened_build 1
|
%global _hardened_build 1
|
||||||
|
|
||||||
Name: timedatex
|
Name: timedatex
|
||||||
Version: 0.6
|
Version: 0.5
|
||||||
Release: 3
|
Release: 9
|
||||||
Summary: D-Bus service for system clock and RTC settings
|
Summary: D-Bus service for system clock and RTC settings
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: https://github.com/mlichvar/timedatex
|
URL: https://github.com/mlichvar/timedatex
|
||||||
Source0: https://github.com/mlichvar/timedatex/archive/v%{version}/%{name}-%{version}.tar.gz
|
Source0: https://github.com/mlichvar/timedatex/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
BuildRequires: glib2-devel libselinux-devel gcc systemd
|
BuildRequires: glib2-devel libselinux-devel
|
||||||
Requires: polkit systemd util-linux
|
Requires: polkit systemd util-linux
|
||||||
|
|
||||||
|
Patch1: timedatex-timeout.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
timedatex is a D-Bus service that implements the org.freedesktop.timedate1
|
timedatex is a D-Bus service that implements the org.freedesktop.timedate1
|
||||||
interface. It can be used to read and set the system clock, the real-time clock
|
interface. It can be used to read and set the system clock, the real-time clock
|
||||||
@ -35,7 +37,7 @@ help document for timedatex.
|
|||||||
%makeinstall unitdir=$RPM_BUILD_ROOT%{_unitdir}
|
%makeinstall unitdir=$RPM_BUILD_ROOT%{_unitdir}
|
||||||
|
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system
|
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system
|
||||||
ln -s /dev/null $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system/timedatex.service
|
ln -s /dev/null $RPM_BUILD_ROOT%{_sysconfdir}/systemd/system/systemd-timedated.service
|
||||||
|
|
||||||
%check
|
%check
|
||||||
make test
|
make test
|
||||||
@ -49,11 +51,12 @@ make test
|
|||||||
%systemd_post %{name}.service
|
%systemd_post %{name}.service
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
|
%systemd_postun_with_restart %{name}.service
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%doc COPYING NEWS README
|
%doc COPYING NEWS README
|
||||||
%{_sysconfdir}/systemd/system/timedatex.service
|
%{_sysconfdir}/systemd/system/systemd-timedated.service
|
||||||
%{_sbindir}/%{name}
|
%{_sbindir}/%{name}
|
||||||
%{_unitdir}/%{name}.service
|
%{_unitdir}/%{name}.service
|
||||||
|
|
||||||
@ -62,31 +65,6 @@ make test
|
|||||||
%{_mandir}/man8/%{name}.8*
|
%{_mandir}/man8/%{name}.8*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Tue Oct 25 2022 yanglongkang<yanglongkang@h-partners.com> - 0.6-3
|
|
||||||
- Type: bugfix
|
|
||||||
- ID: NA
|
|
||||||
- SUG: NA
|
|
||||||
- DESC: rebuild for next release
|
|
||||||
|
|
||||||
* Fri May 28 2021 yangzhuangzhuang <yangzhuangzhuang1@huawei.com>- 0.6-2
|
|
||||||
- Type:bugfix
|
|
||||||
- ID:NA
|
|
||||||
- SUG:NA
|
|
||||||
- DESC:The "cc:No such file or directroy" error message is displayed during compilation.Therefore,add buildrequires gcc.
|
|
||||||
The macro unitdir is used.Therefore,add buildrequires systemd
|
|
||||||
|
|
||||||
* Fri Jul 24 2020 Hugel <gengqihu1@huawei.com> - 0.6.1
|
|
||||||
- Type: enhancement
|
|
||||||
- ID: NA
|
|
||||||
- SUG: NA
|
|
||||||
- DESC: update to 0.6
|
|
||||||
|
|
||||||
* Mon Mar 16 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.5.10
|
|
||||||
- Type: enhancement
|
|
||||||
- ID: NA
|
|
||||||
- SUG: NA
|
|
||||||
- DESC:delete %postun systemd-timedated.service operation
|
|
||||||
|
|
||||||
* Wed Mar 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.5.9
|
* Wed Mar 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.5.9
|
||||||
- Type: enhancement
|
- Type: enhancement
|
||||||
- ID: NA
|
- ID: NA
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
version_control: github
|
|
||||||
src_repo: "mlichvar/timedatex"
|
|
||||||
tag_prefix: "^v"
|
|
||||||
seperator:
|
|
||||||
Loading…
x
Reference in New Issue
Block a user