Magellan Linux

Contents of /trunk/cdparanoia/patches/cdparanoia-3.9.8-sgio-O_EXCL.EBUSY.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 144 - (show annotations) (download)
Tue May 8 20:06:05 2007 UTC (16 years, 11 months ago) by niro
File size: 2463 byte(s)
-import

1 --- cdparanoia-III-alpha9.8/interface/scan_devices.c.ebusy 2005-12-15 10:28:24.000000000 -0500
2 +++ cdparanoia-III-alpha9.8/interface/scan_devices.c 2005-12-15 10:31:15.000000000 -0500
3 @@ -10,6 +10,7 @@
4 #include <stdio.h>
5 #include <unistd.h>
6 #include <stdlib.h>
7 +#include <errno.h>
8 #include <ctype.h>
9 #include <pwd.h>
10 #include <sys/stat.h>
11 @@ -193,7 +194,7 @@
12 /* Ping for CDROM-ness */
13
14 fd=open(device,O_RDONLY|O_NONBLOCK|O_EXCL);
15 - for (i = 0; (i<10) && (fd == -1); i++) {
16 + for (i = 0; i<10 && fd == -1 && errno == EBUSY; i++) {
17 fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", device, strerror(errno));
18 usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
19 fd = open(device,O_RDONLY|O_NONBLOCK|O_EXCL);
20 @@ -327,7 +328,7 @@
21 char buffer[200];
22
23 dev=open(device,O_RDONLY|O_NONBLOCK|O_EXCL);
24 - for (i = 0; (i<10) && (dev == -1); i++) {
25 + for (i = 0; i<10 && dev == -1 && errno == EBUSY; i++) {
26 fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", device, strerror(errno));
27 usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
28 dev = open(device,O_RDONLY|O_NONBLOCK|O_EXCL);
29 @@ -704,14 +705,14 @@
30
31 if(ioctl_device) {
32 i_fd=open(ioctl_device,O_RDONLY|O_NONBLOCK|O_EXCL);
33 - for(i=0; (i<10) && (i_fd==-1); i++) {
34 + for(i=0; i<10 && i_fd==-1 && errno == EBUSY; i++) {
35 fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", ioctl_device, strerror(errno));
36 usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
37 i_fd=open(ioctl_device,O_RDONLY|O_NONBLOCK|O_EXCL);
38 }
39 }
40 g_fd=open(generic_device,O_RDWR|O_EXCL);
41 - for(i=0; (i<10) && (g_fd==-1); i++) {
42 + for(i=0; i<10 && g_fd==-1 && errno == EBUSY; i++) {
43 fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", generic_device, strerror(errno));
44 usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
45 g_fd=open(generic_device,O_RDWR|O_EXCL);
46 @@ -877,7 +878,7 @@
47
48 /* I'm not certain this one nees O_EXCL, but it can't hurt */
49 fd=open(filename,O_RDONLY|O_EXCL);
50 - for(i=0; (i<10) && (fd==-1); i++) {
51 + for(i=0; i<10 && fd==-1 && errno == EBUSY; i++) {
52 fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", filename, strerror(errno));
53 usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0));
54 fd=open(filename,O_RDONLY|O_EXCL);