kdelibs/kdelibs-4.2.2-kde#180785-2.patch
Rex Dieter 43bfaee992 * Sun Apr 19 2009 Rex Dieter <rdieter@fedoraproject.org> 4.2.2-7
- fix and simplify the child struct disposal (kde#180785)
2009-04-19 14:23:14 +00:00

40 lines
967 B
Diff

--- branches/KDE/4.2/kdelibs/kinit/kinit.cpp 2009/04/18 19:34:41 955904
+++ branches/KDE/4.2/kdelibs/kinit/kinit.cpp 2009/04/19 10:43:38 956037
@@ -254,10 +254,9 @@
/* Notify wrapper program that the child it started has finished. */
static void child_died(pid_t exit_pid, int exit_status)
{
- struct child *child = children;
- struct child *prev = NULL;
+ struct child *child, **childptr = &children;
- while (child)
+ while ((child = *childptr))
{
if (child->pid == exit_pid)
{
@@ -272,20 +271,12 @@
write(child->sock, request_data, request_header.arg_length);
close(child->sock);
- if (prev)
- {
- prev->next = child->next;
- }
- else
- {
- child = NULL;
- }
+ *childptr = child->next;
free(child);
return;
}
- prev = child;
- child = child->next;
+ childptr = &child->next;
}
}