Fixed some type and value mismatches. setsignal() returned a bogusly

cast value that was always ignored.  Rev.1.9 of trap.c made this
more bogus by returning a semantically different value after calling
siginterrupt().  Avoid these problems by not returning a value.
This commit is contained in:
Bruce Evans 1997-11-10 11:32:24 +00:00
parent 881377bc7d
commit 28701136f7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31098
2 changed files with 11 additions and 12 deletions

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: trap.c,v 1.8 1997/02/22 13:58:46 peter Exp $
* $Id: trap.c,v 1.9 1997/11/05 23:33:58 ache Exp $
*/
#ifndef lint
@ -205,14 +205,13 @@ clear_traps()
* Set the signal handler for the specified signal. The routine figures
* out what it should be set to.
*/
long
void
setsignal(signo)
int signo;
{
int action;
sig_t sigact = SIG_DFL;
sig_t sig, sigact = SIG_DFL;
char *t;
long sig;
if ((t = trap[signo]) == NULL)
action = S_DFL;
@ -261,7 +260,7 @@ setsignal(signo)
* here, but other shells don't. We don't alter
* sigmode, so that we retry every time.
*/
return 0;
return;
}
if (sigact == SIG_IGN) {
if (mflag && (signo == SIGTSTP ||
@ -274,19 +273,18 @@ setsignal(signo)
}
}
if (*t == S_HARD_IGN || *t == action)
return 0;
return;
switch (action) {
case S_DFL: sigact = SIG_DFL; break;
case S_CATCH: sigact = onsig; break;
case S_IGN: sigact = SIG_IGN; break;
}
*t = action;
sig = (long)signal(signo, sigact);
sig = signal(signo, sigact);
#ifdef BSD
if (sig != -1 && action == S_CATCH)
sig = siginterrupt(signo, 1);
if (sig != SIG_ERR && action == S_CATCH)
siginterrupt(signo, 1);
#endif
return sig;
}
@ -345,6 +343,7 @@ void
onsig(signo)
int signo;
{
#ifndef BSD
signal(signo, onsig);
#endif

View File

@ -34,14 +34,14 @@
* SUCH DAMAGE.
*
* @(#)trap.h 8.3 (Berkeley) 6/5/95
* $Id$
* $Id: trap.h,v 1.6 1997/02/22 13:58:47 peter Exp $
*/
extern int pendingsigs;
int trapcmd __P((int, char **));
void clear_traps __P((void));
long setsignal __P((int));
void setsignal __P((int));
void ignoresig __P((int));
void onsig __P((int));
void dotrap __P((void));