From 9f44299cf202eeb3c0b3f4429782a5dc6cb44773 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 18 Mar 2009 17:25:00 +0000 Subject: [PATCH] Bug fix: burn_abort() did not work with broken output pipe (since rev 2514) --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/drive.c | 36 +++++++++++++++++++---- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index b6cd67f1..e76eff2a 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.03.18.124558" +#define Cdrskin_timestamP "2009.03.18.172512" diff --git a/libburn/trunk/libburn/drive.c b/libburn/trunk/libburn/drive.c index ec4f5fc0..2165b65f 100644 --- a/libburn/trunk/libburn/drive.c +++ b/libburn/trunk/libburn/drive.c @@ -1742,6 +1742,10 @@ int burn_abort(int patience, unsigned long wait_grain= 100000; time_t start_time, current_time, pacifier_time, end_time; +#ifndef NIX + time_t stdio_patience = 3; +#endif + current_time = start_time = pacifier_time = time(0); end_time = start_time + patience; @@ -1758,15 +1762,35 @@ int burn_abort(int patience, if(occup == -2) continue; -#ifdef NIX - /* <<< this causes a race condition with drive usage - and drive disposal - */ if(drive_array[i].drive_role != 1) { + +#ifdef NIX + + /* ts A90302 + <<< this causes a race condition with drive + usage and drive disposal. + */ drive_array[i].busy = BURN_DRIVE_IDLE; burn_drive_forget(&(drive_array[i]), 1); - } else -#endif /* NIX */ + continue; + +#else /* NIX */ + + /* ts A90318 + >>> but if a pipe breaks then the drive + never gets idle. + So for now with a short patience timespan + and eventually a deliberate memory leak. + */ + if (current_time - start_time > + stdio_patience) { + drive_array[i].global_index = -1; + continue; + } + +#endif /* ! NIX */ + + } if(occup <= 10) { burn_drive_forget(&(drive_array[i]), 1);