]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
socket-proxy: port to new sd_event_source_set_exit_on_failure() API
authorLennart Poettering <lennart@poettering.net>
Thu, 1 Oct 2020 20:21:05 +0000 (22:21 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 7 Oct 2020 07:40:05 +0000 (09:40 +0200)
src/socket-proxy/socket-proxyd.c

index 9924220f03272840c428328a42124086089ef4da..64dd623c809daecc2aba27b2a6542e53bb91664d 100644 (file)
@@ -528,11 +528,8 @@ static int accept_cb(sd_event_source *s, int fd, uint32_t revents, void *userdat
         }
 
         r = sd_event_source_set_enabled(s, SD_EVENT_ONESHOT);
-        if (r < 0) {
-                log_error_errno(r, "Error while re-enabling listener with ONESHOT: %m");
-                sd_event_exit(context->event, r);
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Error while re-enabling listener with ONESHOT: %m");
 
         return 1;
 }
@@ -561,11 +558,14 @@ static int add_listen_socket(Context *context, int fd) {
 
         r = set_ensure_put(&context->listen, NULL, source);
         if (r < 0) {
-                log_error_errno(r, "Failed to add source to set: %m");
                 sd_event_source_unref(source);
-                return r;
+                return log_error_errno(r, "Failed to add source to set: %m");
         }
 
+        r = sd_event_source_set_exit_on_failure(source, true);
+        if (r < 0)
+                return log_error_errno(r, "Failed to enable exit-on-failure logic: %m");
+
         /* Set the watcher to oneshot in case other processes are also
          * watching to accept(). */
         r = sd_event_source_set_enabled(source, SD_EVENT_ONESHOT);