Imported Upstream version 2.6.1p1
[debian/amanda] / device-src / rait-device.c
index 5b348927853094df26b103aafed9f599f0ee2c09..d0b0e893c028f263eb445147e12113482b22f1e4 100644 (file)
@@ -1260,6 +1260,8 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label,
 
     dself->access_mode = mode;
     dself->in_file = FALSE;
+    amfree(dself->volume_label);
+    amfree(dself->volume_time);
 
     ops = g_ptr_array_sized_new(self->private->children->len);
     for (i = 0; i < self->private->children->len; i ++) {
@@ -1297,7 +1299,7 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label,
                                            device_error_or_status(child)));
         } else {
            if (child->volume_label != NULL && child->volume_time != NULL) {
-                if (dself->volume_label != NULL && dself->volume_time != NULL) {
+                if (label_from_device) {
                     if (strcmp(child->volume_label, dself->volume_label) != 0 ||
                         strcmp(child->volume_time, dself->volume_time) != 0) {
                         /* Mismatch! (Two devices provided different labels) */
@@ -1313,6 +1315,7 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label,
                                             label_from_device);
                         append_message(&failure_errmsgs, this_message);
                         total_status |= DEVICE_STATUS_DEVICE_ERROR;
+                       g_warning("RAIT device children have different labels or timestamps");
                     }
                 } else {
                     /* First device with a volume. */
@@ -1325,6 +1328,7 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label,
                 char * this_message =
                     g_strdup_printf("%s: Says label read, but no volume "
                                      "label found.", child->device_name);
+               g_warning("RAIT device child has NULL volume or label");
                 append_message(&failure_errmsgs, this_message);
                 total_status |= DEVICE_STATUS_DEVICE_ERROR;
             }
@@ -1336,7 +1340,7 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label,
 
     dself->status = total_status;
 
-    if (!success) {
+    if (total_status != DEVICE_STATUS_SUCCESS || !success) {
        device_set_error(dself, failure_errmsgs, total_status);
         return FALSE;
     }