Print the name of the program using a deprecated syscall.

This commit is contained in:
mycroft 1994-04-24 01:00:39 +00:00
parent 3a8575c7ab
commit aa5c63cbe2
4 changed files with 46 additions and 12 deletions

View File

@ -31,12 +31,13 @@
* SUCH DAMAGE.
*
* from: @(#)kern_prot.c 7.21 (Berkeley) 5/3/91
* $Id: setregid.c,v 1.2 1994/04/10 06:32:42 cgd Exp $
* $Id: setregid.c,v 1.3 1994/04/24 01:00:39 mycroft Exp $
*/
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/uio.h>
extern int __setregid __P((gid_t, gid_t));
@ -46,11 +47,19 @@ setregid(rgid, egid)
{
static int warned;
static char w[] =
"warning: this program uses setregid(), which is deprecated.\r\n";
": warning: this program uses setregid(), which is deprecated.\r\n";
if (!warned) {
(void) write(STDERR_FILENO, w, sizeof(w) - 1);
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 = strlen(w);
(void) writev(STDERR_FILENO, iov, 2);
warned = 1;
}
return (__setregid(rgid, egid));
}

View File

@ -31,12 +31,13 @@
* SUCH DAMAGE.
*
* from: @(#)kern_prot.c 7.21 (Berkeley) 5/3/91
* $Id: setreuid.c,v 1.2 1994/04/10 06:32:44 cgd Exp $
* $Id: setreuid.c,v 1.3 1994/04/24 01:00:40 mycroft Exp $
*/
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/uio.h>
extern int __setreuid __P((uid_t, uid_t));
@ -46,11 +47,19 @@ setreuid(ruid, euid)
{
static int warned;
static char w[] =
"warning: this program uses setreuid(), which is deprecated.\r\n";
": warning: this program uses setreuid(), which is deprecated.\r\n";
if (!warned) {
(void) write(STDERR_FILENO, w, sizeof(w) - 1);
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 = strlen(w);
(void) writev(STDERR_FILENO, iov, 2);
warned = 1;
}
return (__setreuid(ruid, euid));
}

View File

@ -33,11 +33,12 @@
#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.2 1994/04/10 06:32:46 cgd Exp $";
static char *rcsid = "$Id: setrgid.c,v 1.3 1994/04/24 01:00:41 mycroft Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
#include <unistd.h>
#include <sys/uio.h>
int
#ifdef __STDC__
@ -49,10 +50,17 @@ setrgid(rgid)
{
static int warned;
static char w[] =
"warning: this program uses setrgid(), which is deprecated.\r\n";
": warning: this program uses setrgid(), which is deprecated.\r\n";
if (!warned) {
(void) write(STDERR_FILENO, w, sizeof(w) - 1);
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 = strlen(w);
(void) writev(STDERR_FILENO, iov, 2);
warned = 1;
}

View File

@ -33,11 +33,12 @@
#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.3 1994/04/12 23:20:35 cgd Exp $";
static char *rcsid = "$Id: setruid.c,v 1.4 1994/04/24 01:00:42 mycroft Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
#include <unistd.h>
#include <sys/uio.h>
int
#ifdef __STDC__
@ -49,10 +50,17 @@ setruid(ruid)
{
static int warned;
static char w[] =
"warning: this program uses setruid(), which is deprecated.\r\n";
": warning: this program uses setruid(), which is deprecated.\r\n";
if (!warned) {
(void) write(STDERR_FILENO, w, sizeof(w) - 1);
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 = strlen(w);
(void) writev(STDERR_FILENO, iov, 2);
warned = 1;
}