mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
core/mount: disable timer event source when USEC_INFINITY
Setting USEC_INFINITY to timer event source should not cause any problem. But, disabling timer event source should be preferable. [zjs: simplify the call to sd_event_source_set_enabled()]
This commit is contained in:
parent
e323d2e463
commit
57d2b6a96f
@ -195,6 +195,9 @@ static int mount_arm_timer(Mount *m, usec_t usec) {
|
||||
|
||||
assert(m);
|
||||
|
||||
if (usec == USEC_INFINITY)
|
||||
return sd_event_source_set_enabled(m->timer_event_source, SD_EVENT_OFF);
|
||||
|
||||
if (m->timer_event_source) {
|
||||
r = sd_event_source_set_time(m->timer_event_source, usec);
|
||||
if (r < 0)
|
||||
@ -203,9 +206,6 @@ static int mount_arm_timer(Mount *m, usec_t usec) {
|
||||
return sd_event_source_set_enabled(m->timer_event_source, SD_EVENT_ONESHOT);
|
||||
}
|
||||
|
||||
if (usec == USEC_INFINITY)
|
||||
return 0;
|
||||
|
||||
r = sd_event_add_time(
|
||||
UNIT(m)->manager->event,
|
||||
&m->timer_event_source,
|
||||
|
Loading…
Reference in New Issue
Block a user