-
- device_set_startup_properties_from_config(device);
- label_status = device_read_label(device);
-
- if (label_status & READ_LABEL_STATUS_VOLUME_UNLABELED) {
- g_printf("Found an unlabeled tape.\n");
- } else if (label_status != READ_LABEL_STATUS_SUCCESS) {
- g_printf("Reading the tape label failed: \n ");
- print_read_label_status_error(label_status);
+
+ if (!device_configure(device, TRUE)) {
+ error("Could not configure device %s: %s.\n", tapename,
+ device_error(device));
+ }
+
+ device_status = device_read_label(device);
+
+ if (device_status & DEVICE_STATUS_VOLUME_UNLABELED) {
+ /* if there's no header, then the tape was truly empty; otherwise, there
+ * was *something* on the tape, so let's be careful and require a force */
+ if (!device->volume_header || device->volume_header->type == F_EMPTY) {
+ g_printf("Found an empty tape.\n");
+ } else {
+ g_printf("Found a non-Amanda tape.\n");
+ if(!force)
+ tape_ok=0;
+ }
+ } else if (device_status != DEVICE_STATUS_SUCCESS) {
+ g_printf("Reading the tape label failed: %s.\n",
+ device_error_or_status(device));