chiark / gitweb /
admin: Fix premature close in a_bgrelease.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 1 Jan 2007 12:52:32 +0000 (12:52 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 1 Jan 2007 12:52:32 +0000 (12:52 +0000)
The function incorrectly destroys the connection at the release of the
first background job after close; it should wait until they've all
finished.

server/admin.c

index ca5dc8cffe7ca9ea9041b8098d2df7a902afe1b5..7a932ad1ab8f7955e5ce7509805047358606e90d 100644 (file)
@@ -641,7 +641,7 @@ static void a_bgrelease(admin_bgop *bg)
   if (bg->prev) bg->prev->next = bg->next;
   else a->bg = bg->next;
   xfree(bg);
   if (bg->prev) bg->prev->next = bg->next;
   else a->bg = bg->next;
   xfree(bg);
-  if (a->f & AF_CLOSE) a_destroy(a);
+  if (!a->bg && (a->f & AF_CLOSE)) a_destroy(a);
 }
 
 /* --- @a_bgok@, @a_bginfo@, @a_bgfail@ --- *
 }
 
 /* --- @a_bgok@, @a_bginfo@, @a_bgfail@ --- *