X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=xfer-src%2Fxfer-element.c;fp=xfer-src%2Fxfer-element.c;h=37e3377de8cea3bee41eca649318a71608bec55d;hb=109540caa4e37a3663b3dcfb9a205b9609e3f561;hp=dd94e3ca126faafa4ca3ffd055c5fdae49e08ec5;hpb=4c9eba1feb11adf189bceb4001c425e641f0b56a;p=debian%2Famanda diff --git a/xfer-src/xfer-element.c b/xfer-src/xfer-element.c index dd94e3c..37e3377 100644 --- a/xfer-src/xfer-element.c +++ b/xfer-src/xfer-element.c @@ -1,6 +1,6 @@ /* * Amanda, The Advanced Maryland Automatic Network Disk Archiver - * Copyright (c) 2008, 2009, 2010 Zmanda, Inc. All Rights Reserved. + * Copyright (c) 2008-2012 Zmanda, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published @@ -238,11 +238,15 @@ xfer_element_pull_buffer( XferElement *elt, size_t *size) { + xfer_status status; /* Make sure that the xfer is running before calling upstream's * pull_buffer method; this avoids a race condition where upstream * hasn't finished its xfer_element_start yet, and isn't ready for * a pull */ - if (elt->xfer->status == XFER_START) + g_mutex_lock(elt->xfer->status_mutex); + status = elt->xfer->status; + g_mutex_unlock(elt->xfer->status_mutex); + if (status == XFER_START) wait_until_xfer_running(elt->xfer); return XFER_ELEMENT_GET_CLASS(elt)->pull_buffer(elt, size);