Converted to use link-time warning messages.

This commit is contained in:
jtc 1994-07-21 17:13:35 +00:00
parent 2b43180d6d
commit c7527f8b84
5 changed files with 17 additions and 94 deletions

View File

@ -31,35 +31,19 @@
* SUCH DAMAGE.
*
* from: @(#)kern_prot.c 7.21 (Berkeley) 5/3/91
* $Id: setregid.c,v 1.4 1994/04/24 01:06:43 mycroft Exp $
* $Id: setregid.c,v 1.5 1994/07/21 17:13:35 jtc Exp $
*/
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/uio.h>
extern int __setregid __P((gid_t, gid_t));
__warn_references(setregid, "warning: this program uses setregid(), which is deprecated.");
int
setregid(rgid, egid)
int rgid, egid;
{
static int warned;
static char w[] =
": warning: this program uses setregid(), which is deprecated.\r\n";
if (!warned) {
struct iovec iov[2];
extern char *__progname; /* in crt0 */
iov[0].iov_base = __progname;
iov[0].iov_len = strlen(__progname);
iov[1].iov_base = w;
iov[1].iov_len = sizeof(w) - 1;
(void) writev(STDERR_FILENO, iov, 2);
warned = 1;
}
return (__setregid(rgid, egid));
}

View File

@ -31,35 +31,19 @@
* SUCH DAMAGE.
*
* from: @(#)kern_prot.c 7.21 (Berkeley) 5/3/91
* $Id: setreuid.c,v 1.4 1994/04/24 01:06:44 mycroft Exp $
* $Id: setreuid.c,v 1.5 1994/07/21 17:13:37 jtc Exp $
*/
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/uio.h>
extern int __setreuid __P((uid_t, uid_t));
__warn_references(setreuid, "warning: this program uses setreuid(), which is deprecated.");
int
setreuid(ruid, euid)
int ruid, euid;
{
static int warned;
static char w[] =
": warning: this program uses setreuid(), which is deprecated.\r\n";
if (!warned) {
struct iovec iov[2];
extern char *__progname; /* in crt0 */
iov[0].iov_base = __progname;
iov[0].iov_len = strlen(__progname);
iov[1].iov_base = w;
iov[1].iov_len = sizeof(w) - 1;
(void) writev(STDERR_FILENO, iov, 2);
warned = 1;
}
return (__setreuid(ruid, euid));
}

View File

@ -33,12 +33,13 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)setrgid.c 5.5 (Berkeley) 2/23/91";*/
static char *rcsid = "$Id: setrgid.c,v 1.4 1994/04/24 01:06:45 mycroft Exp $";
static char *rcsid = "$Id: setrgid.c,v 1.5 1994/07/21 17:13:38 jtc Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/uio.h>
__warn_references(setrgid, "warning: this program uses setrgid(), which is deprecated.");
int
#ifdef __STDC__
@ -48,21 +49,5 @@ setrgid(rgid)
int rgid;
#endif
{
static int warned;
static char w[] =
": warning: this program uses setrgid(), which is deprecated.\r\n";
if (!warned) {
struct iovec iov[2];
extern char *__progname; /* in crt0 */
iov[0].iov_base = __progname;
iov[0].iov_len = strlen(__progname);
iov[1].iov_base = w;
iov[1].iov_len = sizeof(w) - 1;
(void) writev(STDERR_FILENO, iov, 2);
warned = 1;
}
return (__setregid(rgid, -1));
}

View File

@ -33,12 +33,13 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)setruid.c 5.5 (Berkeley) 2/23/91";*/
static char *rcsid = "$Id: setruid.c,v 1.5 1994/04/24 01:06:46 mycroft Exp $";
static char *rcsid = "$Id: setruid.c,v 1.6 1994/07/21 17:13:39 jtc Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/uio.h>
__warn_references(setruid, "warning: this program uses setruid(), which is deprecated.");
int
#ifdef __STDC__
@ -48,21 +49,5 @@ setruid(ruid)
int ruid;
#endif
{
static int warned;
static char w[] =
": warning: this program uses setruid(), which is deprecated.\r\n";
if (!warned) {
struct iovec iov[2];
extern char *__progname; /* in crt0 */
iov[0].iov_base = __progname;
iov[0].iov_len = strlen(__progname);
iov[1].iov_base = w;
iov[1].iov_len = sizeof(w) - 1;
(void) writev(STDERR_FILENO, iov, 2);
warned = 1;
}
return (__setreuid(ruid, -1));
}

View File

@ -36,12 +36,12 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)gets.c 5.3 (Berkeley) 1/20/91";*/
static char *rcsid = "$Id: gets.c,v 1.5 1994/04/24 01:05:13 mycroft Exp $";
static char *rcsid = "$Id: gets.c,v 1.6 1994/07/21 17:13:51 jtc Exp $";
#endif /* LIBC_SCCS and not lint */
#include <unistd.h>
#include <stdio.h>
#include <sys/uio.h>
__warn_references(gets, "warning: this program uses gets(), which is unsafe.");
char *
gets(buf)
@ -49,21 +49,6 @@ gets(buf)
{
register int c;
register char *s;
static int warned;
static char w[] =
": warning: this program uses gets(), which is unsafe.\r\n";
if (!warned) {
struct iovec iov[2];
extern char *__progname; /* in crt0 */
iov[0].iov_base = __progname;
iov[0].iov_len = strlen(__progname);
iov[1].iov_base = w;
iov[1].iov_len = sizeof(w) - 1;
(void) writev(STDERR_FILENO, iov, 2);
warned = 1;
}
for (s = buf; (c = getchar()) != '\n';)
if (c == EOF)