Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 9250 Details for
Bug 660
wavplay-1.4.ebuild (New Package)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
addressed the errno problem for non-x parts
wavplay-1.4.patch (text/plain), 24.62 KB, created by
Patrick Kursawe (RETIRED)
on 2003-03-11 06:04:27 UTC
(
hide
)
Description:
addressed the errno problem for non-x parts
Filename:
MIME Type:
Creator:
Patrick Kursawe (RETIRED)
Created:
2003-03-11 06:04:27 UTC
Size:
24.62 KB
patch
obsolete
>diff -u wavplay-1.4/Makefile wavplay-1.4-new/Makefile >--- wavplay-1.4/Makefile 1999-12-04 01:06:42.000000000 +0100 >+++ wavplay-1.4-new/Makefile 2003-03-11 11:15:53.000000000 +0100 >@@ -38,7 +38,7 @@ > #---------------------------------------------------------------------- > # If you are running a 386 you should comment this line out. > # >-CPU=-m486 >+# CPU=-m486 > > #---------------------------------------------------------------------- > # If you are experiencing troubles (like core dumps!), then uncomment >@@ -47,7 +47,7 @@ > # adjust the STRIP option to suit compile mode: > # > #DEBUG=-g >-OPT=-O2 >+# OPT=-O2 > > #---------------------------------------------------------------------- > # When using 'DEBUG=-g' above, then comment out the 'strip' line: >@@ -115,7 +115,7 @@ > # Environment variable WAVPLAYPATH will override this value at runtime, if > # present. > # >-PLAYPATH= -DWAVPLAYPATH=\"$(INSTDIR)/wavplay\" >+PLAYPATH= -DWAVPLAYPATH=\"/usr/bin/wavplay\" > > #---------------------------------------------------------------------- > # Minimum DSP sampling rate (default is 4000) >@@ -164,7 +164,7 @@ > # installed). > # > #CUSTINCL= -I/usr/X11R6/include/X11 -I/usr/local/lesstif/include/Xm >- >+CUSTINCL= -I /usr/X11R6/include > #---------------------------------------------------------------------- > # Normally, you shouldn't need to change anything beyond this point: > #---------------------------------------------------------------------- >@@ -173,8 +173,6 @@ > CUSTMOPTS=$(STDGETOPTS) $(PLAYPATH) $(DSPMIN) $(DSPMAX) $(DSPPATH) $(DSPLOCKS) $(USERES) $(NOEDITRES) $(SCHED_PRIORITY) > ELF= # -fPIC > INCL= -I. $(CUSTINCL) >-CCFLAGS= -c $(DEBUG)$(OPT) $(CPU) $(ELF) -fhandle-exceptions $(CUSTMOPTS) -Wall -Wstrict-prototypes >-CFLAGS= -c $(DEBUG)$(OPT) $(CPU) $(ELF) -Wall -Wstrict-prototypes $(CUSTMOPTS) > CC= gcc > CP= g++ > >@@ -184,10 +182,10 @@ > WVDMPO= wavdump.o > > .cc.o: >- $(CP) $(CCFLAGS) $(INCL) $< >+ $(CP) -c $(CCFLAGS) $(CUSTMOPTS) $(INCL) $< > > .c.o: >- $(CC) $(CFLAGS) $(INCL) $< >+ $(CC) -c $(CFLAGS) $(CUSTMOPTS) $(INCL) $< > > all: wavplay wavrec xltwavplay > >diff -u wavplay-1.4/client.c wavplay-1.4-new/client.c >--- wavplay-1.4/client.c 1999-12-04 01:06:42.000000000 +0100 >+++ wavplay-1.4-new/client.c 2003-03-11 10:21:50.000000000 +0100 >@@ -135,7 +135,7 @@ > * communications. > */ > if ( (svrIPC = MsgCreate()) < 0 ) { >- err("%s: creating message queue",sys_errlist[errno]); >+ err("%s: creating message queue",strerror(errno)); > return -1; > } > >@@ -153,12 +153,12 @@ > else execl(env_WAVPLAYPATH,buf,NULL); /* No debug yet */ > > /* Returns only if error occurs */ >- fprintf(stderr,"%s: exec of %s\n",sys_errlist[errno],env_WAVPLAYPATH); >+ fprintf(stderr,"%s: exec of %s\n",strerror(errno),env_WAVPLAYPATH); > exit(2); > > } else if ( svrPID < 0 ) { > e = errno; >- err("%s: forking the server process",sys_errlist[errno]); >+ err("%s: forking the server process",strerror(errno)); > MsgClose(svrIPC); > errno = e; /* Restore error code */ > return -1; >@@ -216,7 +216,7 @@ > if ( (rc = MsgSend(svrIPC,&msg,flags,MSGNO_SRVR)) != 0 && erf != NULL ) > err("%s: Sending server message '%s'", > msg_name(cmd), >- sys_errlist[errno]); >+ strerror(errno)); > return rc; /* Zero indicates success */ > } > >@@ -236,7 +236,7 @@ > msg.bytes = strlen(msg.u.tosvr_path.path); > > if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL ) >- err("%s: Sending server message 'path'",sys_errlist[errno]); >+ err("%s: Sending server message 'path'",strerror(errno)); > return z; > } > >@@ -255,7 +255,7 @@ > msg.bytes = sizeof msg.u.tosvr_bits; > > if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL ) >- err("%s: Sending server message 'bits'",sys_errlist[errno]); >+ err("%s: Sending server message 'bits'",strerror(errno)); > > return z; > } >@@ -275,7 +275,7 @@ > msg.bytes = sizeof msg.u.tosvr_start_sample; > > if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL ) >- err("%s: Sending server message 'start_sample'",sys_errlist[errno]); >+ err("%s: Sending server message 'start_sample'",strerror(errno)); > > return z; > } >@@ -294,7 +294,7 @@ > msg.bytes = sizeof msg.u.tosvr_sampling_rate; > > if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL ) >- err("%s: Sending server message 'sampling_rate'",sys_errlist[errno]); >+ err("%s: Sending server message 'sampling_rate'",strerror(errno)); > > return z; > } >@@ -314,7 +314,7 @@ > msg.bytes = sizeof msg.u.tosvr_chan; > > if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL ) >- err("%s: Sending server message 'tosvr_chan'",sys_errlist[errno]); >+ err("%s: Sending server message 'tosvr_chan'",strerror(errno)); > > return z; > } >@@ -336,7 +336,7 @@ > msg.bytes = sizeof msg.u.tosvr_record; > > if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL ) >- err("%s: Sending server message 'tosvr_record'",sys_errlist[errno]); >+ err("%s: Sending server message 'tosvr_record'",strerror(errno)); > > return z; > } >@@ -356,7 +356,7 @@ > msg.bytes = sizeof msg.u.tosvr_debug; > > if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL ) >- err("%s: Sending server message 'tosvr_debug'",sys_errlist[errno]); >+ err("%s: Sending server message 'tosvr_debug'",strerror(errno)); > > return z; > } >diff -u wavplay-1.4/file.c wavplay-1.4-new/file.c >--- wavplay-1.4/file.c 1999-12-04 01:06:42.000000000 +0100 >+++ wavplay-1.4-new/file.c 2003-03-11 10:30:30.000000000 +0100 >@@ -106,7 +106,7 @@ > WAVFILE *wfile = (WAVFILE *) malloc(sizeof (WAVFILE)); > > if ( wfile == NULL ) { >- err("%s: Allocating WAVFILE structure",sys_errlist[ENOMEM]); >+ err("%s: Allocating WAVFILE structure",strerror(ENOMEM)); > return NULL; > } > >@@ -114,7 +114,7 @@ > > if ( (wfile->Pathname = strdup(Pathname)) == NULL ) { > free(wfile); >- err("%s: Allocating storage for WAVFILE.Pathname",sys_errlist[ENOMEM]); >+ err("%s: Allocating storage for WAVFILE.Pathname",strerror(ENOMEM)); > return NULL; > } > >@@ -166,14 +166,14 @@ > */ > if ( (wfile->fd = open(wfile->Pathname,O_RDONLY)) < 0 ) { > err("%s:\nOpening WAV file %s", >- sys_errlist[errno], >+ strerror(errno), > wfile->Pathname); > goto errxit; > } > > if ( lseek(wfile->fd,0L,SEEK_SET) != 0L ) { > err("%s:\nRewinding WAV file %s", >- sys_errlist[errno], >+ strerror(errno), > wfile->Pathname); > goto errxit; /* Wav file must be seekable device */ > } >@@ -205,12 +205,12 @@ > * Seek to byte count and read dbytes: > */ > if ( lseek(wfile->fd,offset,SEEK_SET) != offset ) { >- err("%s:\nSeeking to WAV data in %s",sys_errlist[errno],wfile->Pathname); >+ err("%s:\nSeeking to WAV data in %s",strerror(errno),wfile->Pathname); > goto errxit; /* Seek failure */ > } > > if ( read(wfile->fd,ubuf,4) != 4 ) { >- err("%s:\nReading dbytes from %s",sys_errlist[errno],wfile->Pathname); >+ err("%s:\nReading dbytes from %s",strerror(errno),wfile->Pathname); > goto errxit; > } > >@@ -308,7 +308,7 @@ > v_erf = erf; /* Set error reporting function */ > > if ( wfile == NULL ) { >- err("%s: WAVFILE pointer is NULL!",sys_errlist[EINVAL]); >+ err("%s: WAVFILE pointer is NULL!",strerror(EINVAL)); > errno = EINVAL; > return -1; > } >@@ -322,9 +322,9 @@ > if ( (e = WaveReadHeader(wfile->fd,&channels,&samplerate,&sample_bits,&samples,&datastart,_v_erf)) != 0 ) > err("%s:\nReading WAV header from %s",emsg,wfile->Pathname); > else if ( lseek(wfile->fd,(long)(datastart-4),SEEK_SET) != (long)(datastart-4) ) >- err("%s:\nSeeking in WAV header file %s",sys_errlist[errno],wfile->Pathname); >+ err("%s:\nSeeking in WAV header file %s",strerror(errno),wfile->Pathname); > else if ( write(wfile->fd,&wfile->wavinfo.Samples,sizeof wfile->wavinfo.Samples) != sizeof wfile->wavinfo.Samples ) >- err("%s:\nWriting in WAV header file %s",sys_errlist[errno],wfile->Pathname); >+ err("%s:\nWriting in WAV header file %s",strerror(errno),wfile->Pathname); > else { > /* > * 'data' chunk was updated OK: Now we have to update the RIFF block >@@ -333,24 +333,24 @@ > */ > if ( ftruncate(wfile->fd,(size_t)fpos) ) > err("%s:\nTruncating file %s to correct size", >- sys_errlist[errno], >+ strerror(errno), > wfile->Pathname); > else if ( lseek(wfile->fd,4L,SEEK_SET) < 0L ) > err("%s:\nSeek 4 for RIFF block update of %s", >- sys_errlist[errno], >+ strerror(errno), > wfile->Pathname); > else { > fpos -= 8; /* Byte count for RIFF block */ > if ( write(wfile->fd,&fpos,sizeof fpos) != sizeof fpos ) > err("%s:\nUpdate of RIFF block count in %s failed", >- sys_errlist[errno], >+ strerror(errno), > wfile->Pathname); > } > } > } > > if ( close(wfile->fd) < 0 ) { >- err("%s:\nClosing WAV file",sys_errlist[errno]); >+ err("%s:\nClosing WAV file",strerror(errno)); > e = errno; /* Save errno value to return */ > } > >@@ -385,7 +385,7 @@ > */ > if ( (wfile->fd = open(wfile->Pathname,O_RDWR|O_TRUNC|O_CREAT,0666)) < 0 ) { > err("%s:\nOpening %s for WAV writing", >- sys_errlist[errno], >+ strerror(errno), > wfile->Pathname); > return NULL; /* Open error */ > } >@@ -427,7 +427,7 @@ > v_erf = erf; /* Set error reporting function */ > > if ( dfile == NULL ) { >- err("%s: Opening DSP device",sys_errlist[errno=ENOMEM]); >+ err("%s: Opening DSP device",strerror(errno=ENOMEM)); > return NULL; > } > >@@ -439,7 +439,7 @@ > */ > if ( (dfile->fd = open(env_AUDIODEV,omode,0)) < 0 ) { > err("%s:\nOpening audio device %s", >- sys_errlist[errno], >+ strerror(errno), > env_AUDIODEV); > goto errxit; > } >@@ -449,7 +449,7 @@ > * setting sampling rate etc. > */ > if ( ioctl(dfile->fd,SNDCTL_DSP_GETBLKSIZE,&dfile->dspblksiz) < 0 ) { >- err("%s: Optaining DSP's block size",sys_errlist[errno]); >+ err("%s: Optaining DSP's block size",strerror(errno)); > goto errxit; > } > >@@ -460,7 +460,7 @@ > /* and 64 for 8130Hz, 8 bit */ > if ( dfile->dspblksiz < 32 || dfile->dspblksiz > 65536 ) { > err("%s: Audio block size (%d bytes)", >- sys_errlist[errno=EINVAL], >+ strerror(errno=EINVAL), > (int)dfile->dspblksiz); > goto errxit; > } >@@ -469,7 +469,7 @@ > * Allocate a buffer to do the I/O through: > */ > if ( (dfile->dspbuf = (char *) malloc(dfile->dspblksiz)) == NULL ) { >- err("%s: For DSP I/O buffer",sys_errlist[errno]); >+ err("%s: For DSP I/O buffer",strerror(errno)); > goto errxit; > } > >@@ -478,7 +478,7 @@ > */ > t = wfile->wavinfo.DataBits; > if ( ioctl(dfile->fd,SNDCTL_DSP_SAMPLESIZE,&t) < 0 ) { >- err("%s: Setting DSP to %u bits",sys_errlist[errno],(unsigned)t); >+ err("%s: Setting DSP to %u bits",strerror(errno),(unsigned)t); > goto errxit; > } > >@@ -488,7 +488,7 @@ > t = wfile->wavinfo.Channels == Stereo ? 1 : 0; > if ( ioctl(dfile->fd,SNDCTL_DSP_STEREO,&t) < 0 ) { > err("%s: Unable to set DSP to %s mode", >- sys_errlist[errno], >+ strerror(errno), > t?"Stereo":"Mono"); > goto errxit; > } >@@ -498,7 +498,7 @@ > */ > ul = wfile->wavinfo.SamplingRate; > if ( ioctl(dfile->fd,SNDCTL_DSP_SPEED,&ul) < 0 ) { >- err("Unable to set audio sampling rate",sys_errlist[errno]); >+ err("Unable to set audio sampling rate",strerror(errno)); > goto errxit; > } > >@@ -530,7 +530,7 @@ > v_erf = erf; /* Set error reporting function */ > > if ( dfile == NULL ) { >- err("%s: DSPFILE is not open",sys_errlist[errno=EINVAL]); >+ err("%s: DSPFILE is not open",strerror(errno=EINVAL)); > return -1; > } > >@@ -540,7 +540,7 @@ > free(dfile); > > if ( close(fd) ) { >- err("%s: Closing DSP fd %d",sys_errlist[errno],fd); >+ err("%s: Closing DSP fd %d",strerror(errno),fd); > return -1; > } > >@@ -565,7 +565,7 @@ > * Check that the WAVFILE is open for reading: > */ > if ( wfile->rw != 'R' ) { >- err("%s: WAVFILE must be open for reading",sys_errlist[errno=EINVAL]); >+ err("%s: WAVFILE must be open for reading",strerror(errno=EINVAL)); > return -1; > } > >@@ -581,7 +581,7 @@ > break; > default : > err("%s: Cannot process %u bit samples", >- sys_errlist[errno=EINVAL], >+ strerror(errno=EINVAL), > (unsigned)wfile->wavinfo.DataBits); > return -1; > } >@@ -593,7 +593,7 @@ > byte_count *= 2; /* Twice as many bytes for stereo */ > else if ( wfile->wavinfo.Channels != Mono ) { > err("%s: DSPFILE control block is corrupted (chan_mode)", >- sys_errlist[errno=EINVAL]); >+ strerror(errno=EINVAL)); > return -1; > } > >@@ -606,7 +606,7 @@ > update_bytes = ((wfile->wavinfo.SamplingRate*byte_modulo) / (RECPLAY_UPDATES_PER_SEC*dfile->dspblksiz)) * dfile->dspblksiz; > > if ( ioctl(dfile->fd,SNDCTL_DSP_SYNC,0) != 0 ) >- err("%s: ioctl(%d,SNDCTL_DSP_SYNC,0)",sys_errlist[errno]); >+ err("%s: ioctl(%d,SNDCTL_DSP_SYNC,0)",strerror(errno)); > > /* Seek to requested start sample */ > lseek(wfile->fd,wfile->StartSample*byte_modulo,SEEK_CUR); >@@ -620,8 +620,8 @@ > > if ( (n = read(wfile->fd,dfile->dspbuf,bytes)) != bytes ) { > if ( n >= 0 ) >- err("Unexpected EOF reading samples from WAV file",sys_errlist[errno=EIO]); >- else err("Reading samples from WAV file",sys_errlist[errno]); >+ err("Unexpected EOF reading samples from WAV file",strerror(errno=EIO)); >+ else err("Reading samples from WAV file",strerror(errno)); > goto errxit; > } > >@@ -635,7 +635,7 @@ > } > > if ( write(dfile->fd,dfile->dspbuf,n) != n ) { >- err("Writing samples to audio device",sys_errlist[errno]); >+ err("Writing samples to audio device",strerror(errno)); > goto errxit; > } > >@@ -651,7 +651,7 @@ > > #if 0 /* I think this is doing a destructive flush: disabled */ > if ( ioctl(dfile->fd,SNDCTL_DSP_SYNC,0) != 0 ) >- err("%s: ioctl(%d,SNDCTL_DSP_SYNC,0)",sys_errlist[errno]); >+ err("%s: ioctl(%d,SNDCTL_DSP_SYNC,0)",strerror(errno)); > #endif > /* Update client time display at end of sucessful play */ > if (clntIPC >= 0) { >@@ -688,7 +688,7 @@ > * Check that the WAVFILE is open for writing: > */ > if ( wfile->rw != 'W' ) { >- err("WAVFILE must be open for writing",sys_errlist[errno=EINVAL]); >+ err("WAVFILE must be open for writing",strerror(errno=EINVAL)); > return -1; > } > >@@ -705,7 +705,7 @@ > break; > default : > err("Cannot process %u bit samples", >- sys_errlist[errno=EINVAL], >+ strerror(errno=EINVAL), > (unsigned)wfile->wavinfo.DataBits); > return -1; > } >@@ -716,7 +716,7 @@ > if ( wfile->wavinfo.Channels == Stereo ) > byte_count *= 2; /* Twice as many bytes for stereo */ > else if ( wfile->wavinfo.Channels != Mono ) { >- err("DSPFILE control block is corrupted (chan_mode)",sys_errlist[errno=EINVAL]); >+ err("DSPFILE control block is corrupted (chan_mode)",strerror(errno=EINVAL)); > return -1; > } > >@@ -747,7 +747,7 @@ > * Read a block of samples: > */ > if ( (n = read(dfile->fd,dfile->dspbuf,bytes)) < 0 ) { >- err("Reading DSP device",sys_errlist[errno]); >+ err("Reading DSP device",strerror(errno)); > goto errxit; > } else if ( n == 0 ) > break; >@@ -756,12 +756,12 @@ > * Write a block of samples to the file: > */ > if ( (bytes = write(wfile->fd,dfile->dspbuf,n)) < 0 ) { >- err("Writing WAV samples to %s",sys_errlist[errno],wfile->Pathname); >+ err("Writing WAV samples to %s",strerror(errno),wfile->Pathname); > goto errxit; > } else if ( bytes != n ) { > if ( bytes > 0 ) > bytes_written += bytes; >- err("Did not write all WAV successfully",sys_errlist[errno=EIO]); >+ err("Did not write all WAV successfully",strerror(errno=EIO)); > goto errxit; > } > >diff -u wavplay-1.4/locks.c wavplay-1.4-new/locks.c >--- wavplay-1.4/locks.c 1999-12-04 01:06:42.000000000 +0100 >+++ wavplay-1.4-new/locks.c 2003-03-11 10:31:04.000000000 +0100 >@@ -125,7 +125,7 @@ > */ > if ( (ipc = semget(LockIPCKey,2,IPC_CREAT|IPC_EXCL|0666)) < 0 && errno != EEXIST ) { > err("Unable to create a semaphore set for key 0x%lX", >- sys_errlist[errno], >+ strerror(errno), > LockIPCKey); > return -1; /* No system IPC resources? */ > } >@@ -157,7 +157,7 @@ > */ > e = errno; /* Save error */ > semctl(ipc,0,IPC_RMID,NULL); /* Destroy bad sems */ >- err("%s: Unable to initialize semaphore set values",sys_errlist[errno=e]); >+ err("%s: Unable to initialize semaphore set values",strerror(errno=e)); > return -1; /* Return err ind. */ > } > } >@@ -199,7 +199,7 @@ > } > > if ( s < 0 ) >- err("%s: Locking the %s semaphore",sys_errlist[errno],playrecx?"Record":"Play"); >+ err("%s: Locking the %s semaphore",strerror(errno),playrecx?"Record":"Play"); > > /* > * Exit this procedure: >@@ -232,7 +232,7 @@ > > if ( s < 0 ) > err("%s: Unlocking the %s semaphore", >- sys_errlist[errno], >+ strerror(errno), > playrecx?"Record":"Play"); > > return s; >diff -u wavplay-1.4/main.c wavplay-1.4-new/main.c >--- wavplay-1.4/main.c 1999-12-04 01:06:42.000000000 +0100 >+++ wavplay-1.4-new/main.c 2003-03-11 10:23:51.000000000 +0100 >@@ -363,7 +363,7 @@ > dup2(fd,2); > close(fd); > } else fprintf(stderr,"%s: cannot go quiet due to /dev/null\n", >- sys_errlist[errno]); >+ strerror(errno)); > } > > /* >@@ -393,7 +393,7 @@ > */ > if ( wavopts.IPCKey && (wavopts.ipc = OpenDSPLocks(wavopts.IPCKey, > !(wavopts.PlayLock.optChar | wavopts.RecdLock.optChar),v_erf)) < 0 ) { >- err("%s: Unable to get audio locking semaphores.",sys_errlist[errno]); >+ err("%s: Unable to get audio locking semaphores.",strerror(errno)); > exit(1); > } > >@@ -405,7 +405,7 @@ > * Remove old semaphore set : > */ > if ( semctl(wavopts.ipc,0,IPC_RMID,NULL) < 0 ) { >- err("%s: Unable to remove old locking semaphores.",sys_errlist[errno]); >+ err("%s: Unable to remove old locking semaphores.",strerror(errno)); > exit(1); > } > >@@ -422,7 +422,7 @@ > * Get replacement semaphores : > */ > if ( wavopts.IPCKey && (wavopts.ipc = OpenDSPLocks(wavopts.IPCKey,0,v_erf)) < 0 ) { >- err("%s: Unable to get audio locking semaphores.",sys_errlist[errno]); >+ err("%s: Unable to get audio locking semaphores.",strerror(errno)); > exit(1); > } > } >@@ -431,7 +431,7 @@ > * -u play unlock request : > */ > if ( wavopts.PlayLock.optChar == OPF_PLAY_UNLOCK && UnlockDSP(wavopts.ipc,0,v_erf) ) { >- err("%s: -%c unlock request failed.",sys_errlist[errno],OPF_PLAY_UNLOCK); >+ err("%s: -%c unlock request failed.",strerror(errno),OPF_PLAY_UNLOCK); > exit(1); > } > >@@ -439,7 +439,7 @@ > * -U record unlock request : > */ > if ( wavopts.RecdLock.optChar == OPF_RECD_UNLOCK && UnlockDSP(wavopts.ipc,1,v_erf) ) { >- err("%s: -%c unlock request failed.",sys_errlist[errno],OPF_RECD_UNLOCK); >+ err("%s: -%c unlock request failed.",strerror(errno),OPF_RECD_UNLOCK); > exit(1); > } > >@@ -447,7 +447,7 @@ > * -l play lock request : > */ > if ( wavopts.PlayLock.optChar == OPF_PLAY_LOCK && LockDSP(wavopts.ipc,0,v_erf,0) ) { >- err("%s: -%c lock request failed.",sys_errlist[errno],OPF_PLAY_LOCK); >+ err("%s: -%c lock request failed.",strerror(errno),OPF_PLAY_LOCK); > exit(1); > } > >@@ -455,7 +455,7 @@ > * -L record lock request : > */ > if ( wavopts.RecdLock.optChar == OPF_RECD_LOCK && LockDSP(wavopts.ipc,1,v_erf,0) ) { >- err("%s: -%c lock request failed.",sys_errlist[errno],OPF_RECD_LOCK); >+ err("%s: -%c lock request failed.",strerror(errno),OPF_RECD_LOCK); > exit(1); > } > >diff -u wavplay-1.4/save_as.c wavplay-1.4-new/save_as.c >--- wavplay-1.4/save_as.c 1999-12-04 01:06:42.000000000 +0100 >+++ wavplay-1.4-new/save_as.c 2003-03-11 10:23:31.000000000 +0100 >@@ -81,7 +81,7 @@ > if ( stat(RECORD_PATH,&src_stat) != 0 ) { > if ( errno == ENOENT ) > ReportErrorf("No file %s to 'save'.",RECORD_PATH); >- else ReportErrorf("%s: doing stat on recorded.wav",sys_errlist[errno]); >+ else ReportErrorf("%s: doing stat on recorded.wav",strerror(errno)); > return; > } > >@@ -139,29 +139,29 @@ > if ( !bCopy ) { > if ( link(RECORD_PATH,path) == 0 ) { /* mv by linking.. */ > if ( unlink(RECORD_PATH) != 0 ) /* And removing the old */ >- ReportErrorf("%s: unlink(%s)",sys_errlist[errno]); >+ ReportErrorf("%s: unlink(%s)",strerror(errno)); > goto rm; /* Success (or mostly success) */ > } else ReportErrorf("%s: link(%s,%s)\nWill try a copy next..", >- sys_errlist[errno],RECORD_PATH,path); >+ strerror(errno),RECORD_PATH,path); > } > > /* > * Copy the file, if control passes to here: > */ > if ( (ifd = open(RECORD_PATH,O_RDONLY,0)) < 0 ) { >- ReportErrorf("%s: opening %s for read.",sys_errlist[errno],RECORD_PATH); >+ ReportErrorf("%s: opening %s for read.",strerror(errno),RECORD_PATH); > goto xit; > } > > if ( (ofd = open(path,O_WRONLY|O_CREAT|O_TRUNC,0644)) < 0 ) { >- ReportErrorf("%s: opening %s for read.",sys_errlist[errno],path); >+ ReportErrorf("%s: opening %s for read.",strerror(errno),path); > close(ifd); > goto xit; > } > > while ( (n = read(ifd,buf,sizeof buf)) > 0 ) > if ( write(ofd,buf,n) < 0 ) { >- ReportErrorf("%s: writing file %s for copy.",sys_errlist[errno],path); >+ ReportErrorf("%s: writing file %s for copy.",strerror(errno),path); > close(ifd); > close(ofd); > unlink(path); >@@ -169,7 +169,7 @@ > } > > if ( n < 0 ) { >- ReportErrorf("%s: reading file %s for copy.",sys_errlist[errno],RECORD_PATH); >+ ReportErrorf("%s: reading file %s for copy.",strerror(errno),RECORD_PATH); > close(ifd); > close(ofd); > unlink(path); >@@ -177,7 +177,7 @@ > } > > if ( fsync(ofd) != 0 ) >- ReportErrorf("%s: fsync(%s)",sys_errlist[errno],path); >+ ReportErrorf("%s: fsync(%s)",strerror(errno),path); > if ( close(ofd) == 0 ) > unlink(RECORD_PATH); /* Delete recorded.wav if copy successful */ > close(ifd); >diff -u wavplay-1.4/server.c wavplay-1.4-new/server.c >--- wavplay-1.4/server.c 1999-12-04 01:06:42.000000000 +0100 >+++ wavplay-1.4-new/server.c 2003-03-11 11:36:00.000000000 +0100 >@@ -326,7 +326,11 @@ > /* > * Tell client the pathname we're using for the recording: > */ >- strcpy(svr.path,RECORD_PATH); /* Always record to same place */ >+ if(strlen(RECORD_PATH) >= sizeof(svr.path)-1) { >+ fprintf(stderr, "Record path %s too long. Truncating.\n", RECORD_PATH); >+ } >+ strncpy(svr.path,RECORD_PATH, sizeof(svr.path)-1); /* Always record to same place */ >+ svr.path[sizeof(svr.path)-1]=0; > > msg.msg_type = ToClnt_Path; > strcpy(msg.u.toclnt_path.path,svr.path); >@@ -397,7 +401,7 @@ > * Remove old semaphore set : > */ > if ( semctl(svr.lockIPCID,0,IPC_RMID,NULL) < 0 ) { >- toclnt_fatal(0,"%s: Unable to remove old locking semaphores.",sys_errlist[errno]); >+ toclnt_fatal(0,"%s: Unable to remove old locking semaphores.",strerror(errno)); > exit(13); > } > >@@ -406,7 +410,7 @@ > */ > if ( (svr.lockIPCID = OpenDSPLocks(svr.IPCKey,1,x_erf)) < 0 ) { > toclnt_fatal(0,"%s:\nAttempting to obtain new locking\nsemaphores.", >- sys_errlist[errno]); >+ strerror(errno)); > exit(13); > } > >@@ -497,7 +501,7 @@ > if ( sched_setscheduler(pid,SCHED_FIFO,&rtp) != 0 ) { > z = errno; > fprintf(stderr,"WARNING; %s: sched_setscheduler(%ld,SCHED_FIFO,) // priority=%d;\n", >- sys_errlist[z],(long)pid,(int)SCHED_PRIORITY); >+ strerror(z),(long)pid,(int)SCHED_PRIORITY); > if ( z == EPERM && rtp.sched_priority > 0 ) > fputs("You need setuid root to use sched_setscheduler()\n",stderr); > fflush(stderr); >@@ -531,7 +535,7 @@ > msg.bytes = 0; > > if ( MsgToClient(clntIPC,&msg,flags) != 0 ) { /* Send to client */ >- ClntMsg("%s: toclnt_ready(flags=0%o;ipc=%d)\n",sys_errlist[errno],flags,clntIPC); >+ ClntMsg("%s: toclnt_ready(flags=0%o;ipc=%d)\n",strerror(errno),flags,clntIPC); > exit(13); > } > } >@@ -550,7 +554,7 @@ > msg.u.toclnt_bits.DataBits = bits; > > if ( MsgToClient(clntIPC,&msg,flags) != 0 ) { /* Send to client */ >- ClntMsg("%s: toclnt_ready(flags=0%o;ipc=%d)\n",sys_errlist[errno],flags,clntIPC); >+ ClntMsg("%s: toclnt_ready(flags=0%o;ipc=%d)\n",strerror(errno),flags,clntIPC); > exit(13); > } > } >@@ -602,7 +606,7 @@ > msg.bytes = sizeof msg.u.toclnt_settings; > > if ( (z = MsgToClient(clntIPC,&msg,flags)) != 0 && flags && errno != EAGAIN ) { >- toclnt_fatal(0,"%s: toclnt_settings(flags=0%o;ipc=%d)\n",sys_errlist[errno],flags,clntIPC); >+ toclnt_fatal(0,"%s: toclnt_settings(flags=0%o;ipc=%d)\n",strerror(errno),flags,clntIPC); > exit(13); > } > >@@ -645,7 +649,7 @@ > [sizeof msg.u.toclnt_errmsg.msg - 1] = 0; > > if ( MsgToClient(clntIPC,&msg,flags) != 0 ) { /* Send to client */ >- fprintf(stderr,"%s: toclnt_errmsg(...)\n",sys_errlist[errno]); >+ fprintf(stderr,"%s: toclnt_errmsg(...)\n",strerror(errno)); > exit(13); > } > } >diff -u wavplay-1.4/wavfile.c wavplay-1.4-new/wavfile.c >--- wavplay-1.4/wavfile.c 1999-12-04 01:06:42.000000000 +0100 >+++ wavplay-1.4-new/wavfile.c 2003-03-11 10:22:41.000000000 +0100 >@@ -141,7 +141,7 @@ > waveheader.nDataBytes = databytes; > > if (write (wavefile, &waveheader, sizeof (WAVE_HEADER)) != sizeof (WAVE_HEADER)) { >- err("%s",sys_errlist[errno]); /* wwg: report the error */ >+ err("%s",strerror(errno)); /* wwg: report the error */ > return WW_BADWRITEHEADER ; > } > >@@ -157,7 +157,7 @@ > v_erf = erf; /* wwg: Set error reporting function */ > > if (lseek (wavefile, 0L, SEEK_SET)) { >- err("%s",sys_errlist[errno]); /* wwg: Report error */ >+ err("%s",strerror(errno)); /* wwg: Report error */ > return WR_BADSEEK ; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 660
:
164
|
9249
| 9250