.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=699
This commit is contained in:
parent
c898064f3d
commit
1f78014dae
@ -5,9 +5,9 @@ Subject: [PATCH] core: close socket fds asynchronously
|
||||
|
||||
http://lists.freedesktop.org/archives/systemd-devel/2014-April/018928.html
|
||||
---
|
||||
src/core/async.c | 22 ++++++++++++++++++++++
|
||||
src/core/async.c | 24 ++++++++++++++++++++++++
|
||||
src/core/service.c | 5 +++--
|
||||
2 files changed, 25 insertions(+), 2 deletions(-)
|
||||
2 files changed, 27 insertions(+), 2 deletions(-)
|
||||
|
||||
--- src/core/service.c
|
||||
+++ src/core/service.c 2014-05-16 11:41:50.150735247 +0000
|
||||
@ -47,13 +47,15 @@ http://lists.freedesktop.org/archives/systemd-devel/2014-April/018928.html
|
||||
|
||||
int asynchronous_job(void* (*func)(void *p), void *arg) {
|
||||
pthread_attr_t a;
|
||||
@@ -70,3 +71,24 @@ int asynchronous_sync(void) {
|
||||
@@ -70,3 +71,26 @@ int asynchronous_sync(void) {
|
||||
|
||||
return asynchronous_job(sync_thread, NULL);
|
||||
}
|
||||
+
|
||||
+static void *close_thread(void *p) {
|
||||
+ close_nointr_nofail(PTR_TO_INT(p));
|
||||
+ int fd = PTR_TO_INT(p);
|
||||
+ if (fd >= 0)
|
||||
+ close_nointr_nofail(fd);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
@ -67,7 +69,7 @@ http://lists.freedesktop.org/archives/systemd-devel/2014-April/018928.html
|
||||
+ * far away as we can. */
|
||||
+
|
||||
+ r = asynchronous_job(close_thread, INT_TO_PTR(fd));
|
||||
+ if (r < 0)
|
||||
+ if (r < 0 && fd >= 0)
|
||||
+ close_nointr_nofail(fd);
|
||||
+
|
||||
+ return -1;
|
||||
|
@ -53,16 +53,17 @@ index c32a7ef..d4334b4 100644
|
||||
return udev_queue;
|
||||
}
|
||||
|
||||
@@ -107,6 +110,8 @@ _public_ struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue)
|
||||
@@ -107,6 +110,9 @@ _public_ struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue)
|
||||
if (udev_queue->refcount > 0)
|
||||
return NULL;
|
||||
|
||||
+ close_nointr_nofail(udev_queue->fd);
|
||||
+ if (udev_queue->fd >= 0)
|
||||
+ close_nointr_nofail(udev_queue->fd);
|
||||
+
|
||||
free(udev_queue);
|
||||
return NULL;
|
||||
}
|
||||
@@ -222,3 +227,44 @@ _public_ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_qu
|
||||
@@ -222,3 +228,44 @@ _public_ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_qu
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 1 09:58:04 UTC 2014 - werner@suse.de
|
||||
|
||||
- Be aware that close_nointr_nofail() may fail whereas safe_close() not
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 1 08:56:48 UTC 2014 - werner@suse.de
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 1 09:58:04 UTC 2014 - werner@suse.de
|
||||
|
||||
- Be aware that close_nointr_nofail() may fail whereas safe_close() not
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 1 08:56:48 UTC 2014 - werner@suse.de
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user