Subject: lib/15686: signal(3) should mention SIG_ERR
To: None <gnats-bugs@gnats.netbsd.org>
From: None <rb-netbsd@bigscarychildren.net>
List: netbsd-bugs
Date: 02/20/2002 23:34:35
>Number:         15686
>Category:       lib
>Synopsis:       signal(3) should mention SIG_ERR as error return instead of -1
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 20 20:35:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Rick Byers
>Release:        NetBSD 1.5ZA
>Organization:

>Environment:
	
	
System: NetBSD Apenheul.BigScaryChildren.net 1.5ZA NetBSD 1.5ZA (WORMHOLE) #1: Sun Jan 13 13:47:22 EST 2002 root@Apenheul.BigScaryChildren.net:/usr/src/sys/arch/i386/compile/WORMHOLE i386
Architecture: i386
Machine: i386
>Description:
	The signal(3) manpage says that signal() returns -1 on error.
	However, signal() returns a pointer to a function, and so an explicit cast
	is required to check against -1.  The SIG_ERR macro in sys/signal.h is
	provided exactly for this reason, and its much more elegant to write
	if( signal(...) == SIG_ERR ), than
	if( signal(...) == (void (*) (int))-1 )

>How-To-Repeat:
	man 3 signal
>Fix:
*** signal.3    2002/02/07 07:00:17     1.16
--- signal.3    2002/02/21 04:30:52
***************
*** 150,156 ****
  ignored signals remain ignored.
  .Sh RETURN VALUES
  The previous action is returned on a successful call.
! Otherwise, \-1 is returned and  the global variable
  .Va errno
  is set to indicate the error.
  .Sh ERRORS
--- 150,158 ----
  ignored signals remain ignored.
  .Sh RETURN VALUES
  The previous action is returned on a successful call.
! Otherwise,
! .Dv SIG_ERR
! is returned and  the global variable
  .Va errno
  is set to indicate the error.
  .Sh ERRORS
>Release-Note:
>Audit-Trail:
>Unformatted: