diff --git a/cdparanoia-III-alpha9.8.O_EXCL.patch b/cdparanoia-III-alpha9.8.O_EXCL.patch new file mode 100644 index 0000000..49fa20b --- /dev/null +++ b/cdparanoia-III-alpha9.8.O_EXCL.patch @@ -0,0 +1,155 @@ +--- cdparanoia-III-alpha9.8/interface/scan_devices.c.O_EXCL 2001-03-26 00:44:01.000000000 -0500 ++++ cdparanoia-III-alpha9.8/interface/scan_devices.c 2003-05-20 14:33:16.000000000 -0400 +@@ -148,7 +148,7 @@ + + cdrom_drive *d=NULL; + struct stat st; +- int fd=-1; ++ int fd=-1, i; + int type; + char *description=NULL; + char *device; +@@ -180,7 +180,12 @@ + /* Yay, ATAPI... */ + /* Ping for CDROM-ness */ + +- fd=open(device,O_RDONLY|O_NONBLOCK); ++ fd=open(device,O_RDONLY|O_NONBLOCK|O_EXCL); ++ for (i = 0; (i<10) && (fd == -1); i++) { ++ fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", device, strerror(errno)); ++ usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0)); ++ fd = open(device,O_RDONLY|O_NONBLOCK|O_EXCL); ++ } + if(fd==-1){ + idperror(messagedest,messages,"\t\tUnable to open %s",device); + free(device); +@@ -250,14 +255,6 @@ + return(NULL); + } + +- if(fd==-1)fd=open(device,O_RDONLY|O_NONBLOCK); +- if(fd==-1){ +- idperror(messagedest,messages,"\t\tUnable to open %s",device); +- free(device); +- if(description)free(description); +- return(NULL); +- } +- + /* Minimum init */ + + d=calloc(1,sizeof(cdrom_drive)); +@@ -311,12 +308,19 @@ + char *devfs_test, + char *devfs_other, + char *prompt,int messagedest,char **messages){ +- int dev=open(device,O_RDONLY|O_NONBLOCK); ++ int dev=-1; + scsiid a,b; + + int i,j; + char buffer[200]; + ++ dev=open(device,O_RDONLY|O_NONBLOCK|O_EXCL); ++ for (i = 0; (i<10) && (dev == -1); i++) { ++ fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", device, strerror(errno)); ++ usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0)); ++ dev = open(device,O_RDONLY|O_NONBLOCK|O_EXCL); ++ } ++ + /* if we're running under /devfs, build the device name from the + device we already have */ + if(!strncmp(device,devfs_test,strlen(devfs_test))){ +@@ -327,6 +331,11 @@ + int matchf; + sprintf(pos,"/%s",devfs_other); + matchf=open(buffer,O_RDONLY|O_NONBLOCK); ++ for (i = 0; (i<10) && (matchf==-1); i++) { ++ fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 seconds.\n", buffer, strerror(errno)); ++ usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0)); ++ matchf = open(buffer,O_RDONLY|O_NONBLOCK); ++ } + if(matchf!=-1){ + close(matchf); + close(dev); +@@ -353,7 +362,7 @@ + for(i=0;i<25;i++){ + for(j=0;j<2;j++){ + int pattern=0; +- int matchf; ++ int matchf, k; + + while(prefixes[pattern]!=NULL){ + switch(j){ +@@ -368,6 +377,12 @@ + } + + matchf=open(buffer,O_RDONLY|O_NONBLOCK); ++ for (k = 0; (k<10) && (matchf==-1); k++) { ++ fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", buffer, strerror(errno)); ++ usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0)); ++ matchf=open(buffer,O_RDONLY|O_NONBLOCK); ++ } ++ + if(matchf!=-1){ + if(get_scsi_id(matchf,&b)==0){ + if(a.bus==b.bus && a.id==b.id && a.lun==b.lun){ +@@ -438,7 +453,7 @@ + cdrom_drive *d=NULL; + struct stat i_st; + struct stat g_st; +- int i_fd=-1; ++ int i_fd=-1, i; + int g_fd=-1; + int version; + int type; +@@ -534,8 +549,20 @@ + goto cdda_identify_scsi_fail; + } + +- if(ioctl_device)i_fd=open(ioctl_device,O_RDONLY|O_NONBLOCK); +- g_fd=open(generic_device,O_RDWR); ++ if(ioctl_device) { ++ i_fd=open(ioctl_device,O_RDONLY|O_NONBLOCK|O_EXCL); ++ for(i=0; (i<10) && (i_fd==-1); i++) { ++ fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", ioctl_device, strerror(errno)); ++ usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0)); ++ i_fd=open(ioctl_device,O_RDONLY|O_NONBLOCK|O_EXCL); ++ } ++ } ++ g_fd=open(generic_device,O_RDWR|O_EXCL); ++ for(i=0; (i<10) && (g_fd==-1); i++) { ++ fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", generic_device, strerror(errno)); ++ usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0)); ++ g_fd=open(generic_device,O_RDWR|O_EXCL); ++ } + + if(ioctl_device && i_fd==-1) + idperror(messagedest,messages,"\t\tCould not open SCSI cdrom device " +@@ -661,7 +688,7 @@ + + cdrom_drive *d=NULL; + struct stat st; +- int fd=-1; ++ int fd=-1,i; + + idmessage(messagedest,messages,"\tTesting %s for file/test interface", + filename); +@@ -678,7 +705,17 @@ + return(NULL); + } + +- fd=open(filename,O_RDONLY); ++ /* I'm not certain this one nees O_EXCL, but it can't hurt */ ++ fd=open(filename,O_RDONLY|O_EXCL); ++ for(i=0; (i<10) && (fd==-1); i++) { ++ fprintf(stderr, "Error trying to open %s exclusively (%s). retrying in 1 second.\n", filename, strerror(errno)); ++ usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0)); ++ fd=open(filename,O_RDONLY|O_EXCL); ++ } ++ ++ if(ioctl_device && i_fd==-1) ++ idperror(messagedest,messages,"\t\tCould not open SCSI cdrom device " ++ "%s (continuing)",ioctl_device); + + if(fd==-1){ + idperror(messagedest,messages,"\t\tCould not open file %s",filename); diff --git a/cdparanoia-III-alpha9.8.labels.patch b/cdparanoia-III-alpha9.8.labels.patch new file mode 100644 index 0000000..8a760c2 --- /dev/null +++ b/cdparanoia-III-alpha9.8.labels.patch @@ -0,0 +1,38 @@ +--- cdparanoia-III-alpha9.8/interface/utils.h.labels 2003-05-06 10:35:43.000000000 -0400 ++++ cdparanoia-III-alpha9.8/interface/utils.h 2003-05-06 10:36:05.000000000 -0400 +@@ -110,8 +110,6 @@ + case CDDA_MESSAGE_LOGIT: + d->errorbuf=catstring(d->errorbuf,s); + break; +- case CDDA_MESSAGE_FORGETIT: +- default: + } + } + } +@@ -125,8 +123,6 @@ + case CDDA_MESSAGE_LOGIT: + d->messagebuf=catstring(d->messagebuf,s); + break; +- case CDDA_MESSAGE_FORGETIT: +- default: + } + } + } +@@ -167,8 +163,6 @@ + } + } + break; +- case CDDA_MESSAGE_FORGETIT: +- default: + } + } + if(malloced)free(buffer); +@@ -203,8 +197,6 @@ + if(!malloced)*messages=catstring(*messages,"\n"); + } + break; +- case CDDA_MESSAGE_FORGETIT: +- default: + } + } + if(malloced)free(buffer); diff --git a/cdparanoia.spec b/cdparanoia.spec index 2a28db1..822a85e 100644 --- a/cdparanoia.spec +++ b/cdparanoia.spec @@ -3,11 +3,13 @@ Name: cdparanoia Version: %{realver} -Release: 15 +Release: 18 License: GPL Group: Applications/Multimedia Source: http://www.xiph.org/paranoia/download/%{name}-III-%{realver}.src.tgz Patch0: cdparanoia-III-alpha9.8.nostrip.patch +Patch1: cdparanoia-III-alpha9.8.labels.patch +Patch2: cdparanoia-III-alpha9.8.O_EXCL.patch Url: http://www.xiph.org/paranoia/index.html BuildRoot: %{_tmppath}/cdparanoia-%{version}-root Requires: cdparanoia-libs = %{version}-%{release} @@ -44,6 +46,8 @@ applications which read CD Digital Audio disks. %prep %setup -q -n %{name}-III-%{realver} %patch0 -p1 -b .nostrip +%patch1 -p1 -b .labels +%patch2 -p1 -b .O_EXCL %build rm -rf $RPM_BUILD_ROOT @@ -101,6 +105,17 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/*.a %changelog +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Tue May 20 2003 Peter Jones alpha9.8-17 +- typo fix (g_fd -> fd) +- add errno output + +* Tue May 06 2003 Peter Jones alpha9.8-16 +- fix warnings on switches +- use O_EXCL + * Tue Feb 04 2003 Florian La Roche - add symlinks to shared libs