Retrying 3 times on EBUSY drives with generous usleep intervals
This commit is contained in:
parent
1ccedd5572
commit
b65b852c15
@ -1 +1 @@
|
||||
#define Cdrskin_timestamP "2009.06.03.185118"
|
||||
#define Cdrskin_timestamP "2009.06.14.095004"
|
||||
|
@ -470,7 +470,7 @@ static int sg_fcntl_lock(int *fd, char *fd_name, int l_type, int verbous)
|
||||
/* ts A60926 */
|
||||
static int sg_open_drive_fd(char *fname, int scan_mode)
|
||||
{
|
||||
int open_mode = O_RDWR, fd;
|
||||
int open_mode = O_RDWR, fd, tries= 0;
|
||||
char msg[81];
|
||||
|
||||
/* ts A70409 : DDLP-B */
|
||||
@ -503,6 +503,7 @@ static int sg_open_drive_fd(char *fname, int scan_mode)
|
||||
!!(open_mode&O_EXCL),!!(open_mode&O_NDELAY));
|
||||
*/
|
||||
|
||||
try_open:;
|
||||
fd = open(fname, open_mode);
|
||||
if (fd == -1) {
|
||||
/* <<< debugging
|
||||
@ -511,6 +512,17 @@ static int sg_open_drive_fd(char *fname, int scan_mode)
|
||||
fname,errno);
|
||||
*/
|
||||
if (errno == EBUSY) {
|
||||
tries++;
|
||||
|
||||
/* <<< debugging
|
||||
fprintf(stderr,
|
||||
"\nlibburn_DEBUG: EBUSY , tries= %d\n", tries);
|
||||
*/
|
||||
|
||||
if (tries < 4) {
|
||||
usleep(2000000);
|
||||
goto try_open;
|
||||
}
|
||||
sg_handle_busy_device(fname, errno);
|
||||
return -1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user