diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-04-06 18:58:55 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-08-24 16:47:08 +0200 |
commit | 9d1ff89d622fd4d8b3be210996cfa73943d81e03 (patch) | |
tree | 102f525976d4d49adff59adba7ca7c0d9e825a14 /src/libelogind/sd-event | |
parent | 5642683e0db55c457dcd03df1290334a238194e2 (diff) |
tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.
I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
Diffstat (limited to 'src/libelogind/sd-event')
-rw-r--r-- | src/libelogind/sd-event/sd-event.c | 37 | ||||
-rw-r--r-- | src/libelogind/sd-event/test-event.c | 13 |
2 files changed, 16 insertions, 34 deletions
diff --git a/src/libelogind/sd-event/sd-event.c b/src/libelogind/sd-event/sd-event.c index eda32f671..a32fe9fd7 100644 --- a/src/libelogind/sd-event/sd-event.c +++ b/src/libelogind/sd-event/sd-event.c @@ -3,19 +3,6 @@ This file is part of systemd. Copyright 2013 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ #include <sys/epoll.h> @@ -2403,7 +2390,6 @@ static int event_prepare(sd_event *e) { static int dispatch_exit(sd_event *e) { sd_event_source *p; - _cleanup_(sd_event_unrefp) sd_event *ref = NULL; int r; assert(e); @@ -2414,11 +2400,15 @@ static int dispatch_exit(sd_event *e) { return 0; } - ref = sd_event_ref(e); + sd_event_ref(e); e->iteration++; e->state = SD_EVENT_EXITING; + r = source_dispatch(p); + e->state = SD_EVENT_INITIAL; + sd_event_unref(e); + return r; } @@ -2658,12 +2648,14 @@ _public_ int sd_event_dispatch(sd_event *e) { p = event_next_pending(e); if (p) { - _cleanup_(sd_event_unrefp) sd_event *ref = NULL; + sd_event_ref(e); - ref = sd_event_ref(e); e->state = SD_EVENT_RUNNING; r = source_dispatch(p); e->state = SD_EVENT_INITIAL; + + sd_event_unref(e); + return r; } @@ -2730,7 +2722,6 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) { } _public_ int sd_event_loop(sd_event *e) { - _cleanup_(sd_event_unrefp) sd_event *ref = NULL; int r; assert_return(e, -EINVAL); @@ -2738,15 +2729,19 @@ _public_ int sd_event_loop(sd_event *e) { assert_return(!event_pid_changed(e), -ECHILD); assert_return(e->state == SD_EVENT_INITIAL, -EBUSY); - ref = sd_event_ref(e); + sd_event_ref(e); while (e->state != SD_EVENT_FINISHED) { r = sd_event_run(e, (uint64_t) -1); if (r < 0) - return r; + goto finish; } - return e->exit_code; + r = e->exit_code; + +finish: + sd_event_unref(e); + return r; } _public_ int sd_event_get_fd(sd_event *e) { diff --git a/src/libelogind/sd-event/test-event.c b/src/libelogind/sd-event/test-event.c index c51af4b9a..95b0f0f8e 100644 --- a/src/libelogind/sd-event/test-event.c +++ b/src/libelogind/sd-event/test-event.c @@ -3,19 +3,6 @@ This file is part of systemd. Copyright 2013 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ #include <sys/wait.h> |