X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=device-src%2Fnull-device.c;h=d5f7106d7754653ef8d71d649215cebe5f1c72d6;hb=949b8910a5e23c4285d0b1aedacfc82a14dc97a5;hp=f7898e2fb3c36f25d3a41a4e9e715b339c58852d;hpb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;p=debian%2Famanda diff --git a/device-src/null-device.c b/device-src/null-device.c index f7898e2..d5f7106 100644 --- a/device-src/null-device.c +++ b/device-src/null-device.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2009, 2010 Zmanda, Inc. All Rights Reserved. + * Copyright (c) 2007-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 @@ -50,7 +50,6 @@ struct _NullDevice { typedef struct _NullDeviceClass NullDeviceClass; struct _NullDeviceClass { DeviceClass __parent__; - gboolean in_file; }; void null_device_register(void); @@ -237,11 +236,14 @@ null_device_start (Device * pself, DeviceAccessMode mode, if (device_in_error(self)) return FALSE; pself->access_mode = mode; + g_mutex_lock(pself->device_mutex); pself->in_file = FALSE; + g_mutex_unlock(pself->device_mutex); if (mode == ACCESS_WRITE) { pself->volume_label = newstralloc(pself->volume_label, label); pself->volume_time = newstralloc(pself->volume_time, timestamp); + pself->header_block_size = 32768; return TRUE; } else { device_set_error(pself, @@ -265,7 +267,9 @@ static gboolean null_device_start_file(Device * d_self, dumpfile_t * jobInfo G_GNUC_UNUSED) { + g_mutex_lock(d_self->device_mutex); d_self->in_file = TRUE; + g_mutex_unlock(d_self->device_mutex); d_self->is_eom = FALSE; d_self->block = 0; if (d_self->file <= 0) @@ -293,6 +297,8 @@ static gboolean null_device_finish_file(Device * pself) { if (device_in_error(pself)) return FALSE; + g_mutex_lock(pself->device_mutex); pself->in_file = FALSE; + g_mutex_unlock(pself->device_mutex); return TRUE; }