From 9cb4e4281ef02e0759f3482a2b5d22e1a3d57a87 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) --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/drive.c | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index b6cd67f..e76eff2 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.03.18.124558" +#define Cdrskin_timestamP "2009.03.18.172512" diff --git a/libburn/drive.c b/libburn/drive.c index ec4f5fc..2165b65 100644 --- a/libburn/drive.c +++ b/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);