From 8b090d247a059021fb84c6962a43e91d2e4ab964 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Sun, 5 Jan 2003 23:28:05 +0000 Subject: [PATCH] Only system headers should declare errno Many parts of krb5 declare errno in source files using extern int errno. This has not been needed in ANSI C for a long time, and actively breaks modern versions of glibc. So these declarations are removed and errno.h included where necessary. Ticket: new Component: krb5-build git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15082 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 4 ++++ src/appl/bsd/login.c | 2 +- src/kadmin/v4server/ChangeLog | 6 ++++++ src/kadmin/v4server/acl_files.c | 3 +-- src/kadmin/v4server/admin_server.c | 1 - src/lib/kadm5/srv/ChangeLog | 6 ++++++ src/lib/kadm5/srv/adb_policy.c | 2 +- src/lib/kadm5/srv/server_dict.c | 3 ++- src/lib/krb4/ChangeLog | 6 ++++++ src/lib/krb4/dest_tkt.c | 1 - src/lib/krb4/tf_util.c | 1 - src/lib/krb5/posix/ChangeLog | 4 ++++ src/lib/krb5/posix/syslog.c | 2 +- src/lib/rpc/ChangeLog | 7 +++++++ src/lib/rpc/clnt_udp.c | 2 +- src/lib/rpc/pmap_getmaps.c | 1 - src/lib/rpc/pmap_rmt.c | 1 - src/lib/rpc/svc_auth_gssapi.c | 2 +- src/lib/rpc/svc_run.c | 3 +-- src/lib/rpc/svc_udp.c | 1 - src/tests/dejagnu/ChangeLog | 4 ++++ src/tests/dejagnu/t_inetd.c | 1 - src/util/db2/ChangeLog | 4 ++++ src/util/db2/clib/mkstemp.c | 1 - src/util/db2/test/ChangeLog | 4 ++++ src/util/db2/test/Makefile | 11 +++++++++-- src/util/db2/test/SEQ_TEST/t.c | 1 - src/util/ss/ChangeLog | 6 ++++++ src/util/ss/help.c | 2 +- src/util/ss/pager.c | 2 +- 30 files changed, 71 insertions(+), 23 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 202ae14ef..46e005c57 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,7 @@ +2003-01-05 Sam Hartman + + * login.c: Remove declaration of errno + 2003-01-03 Ezra Peisach * compat_recv.c (accept_a_connection): Test if IPv6 socket returns diff --git a/src/appl/bsd/login.c b/src/appl/bsd/login.c index f1ebff4f7..eeab4b2ac 100644 --- a/src/appl/bsd/login.c +++ b/src/appl/bsd/login.c @@ -304,7 +304,7 @@ char term[64], *hostname, *username; char term[64], *username; #endif -extern int errno; + #ifdef KRB4 #define KRB_ENVIRON "KRBTKFILE" /* Ticket file environment variable */ diff --git a/src/kadmin/v4server/ChangeLog b/src/kadmin/v4server/ChangeLog index cdae96991..272af6668 100644 --- a/src/kadmin/v4server/ChangeLog +++ b/src/kadmin/v4server/ChangeLog @@ -1,3 +1,9 @@ +2003-01-05 Sam Hartman + + * admin_server.c (kadm_listen): Remove declaration of errno + + * acl_files.c: Remove declaration of errno + 2002-11-26 Tom Yu * Makefile.in (OBJS): Remove kadm_stream.o and kadm_err.o. Also, diff --git a/src/kadmin/v4server/acl_files.c b/src/kadmin/v4server/acl_files.c index bbc9bb71b..1df4d3039 100644 --- a/src/kadmin/v4server/acl_files.c +++ b/src/kadmin/v4server/acl_files.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include "krb.h" @@ -51,7 +51,6 @@ #define COR(a,b) ((a!=NULL)?(a):(b)) -extern int errno; #ifndef HAVE_STDLIB_H extern char *malloc(), *calloc(); diff --git a/src/kadmin/v4server/admin_server.c b/src/kadmin/v4server/admin_server.c index 8aaf0888f..527f19341 100644 --- a/src/kadmin/v4server/admin_server.c +++ b/src/kadmin/v4server/admin_server.c @@ -284,7 +284,6 @@ listen on the admin servers port for a request static int kadm_listen() { - extern int errno; int found; int admin_fd; int peer_fd; diff --git a/src/lib/kadm5/srv/ChangeLog b/src/lib/kadm5/srv/ChangeLog index 22e1d2d4e..106c2bee7 100644 --- a/src/lib/kadm5/srv/ChangeLog +++ b/src/lib/kadm5/srv/ChangeLog @@ -1,3 +1,9 @@ +2003-01-05 Sam Hartman + + * server_dict.c: Remove declaration of errno + + * adb_policy.c: Remove declaration of errno + 2002-12-16 Ezra Peisach * Makefile.in: Change to allow compilation with-system-db and diff --git a/src/lib/kadm5/srv/adb_policy.c b/src/lib/kadm5/srv/adb_policy.c index 7403d31a7..f081551d7 100644 --- a/src/lib/kadm5/srv/adb_policy.c +++ b/src/lib/kadm5/srv/adb_policy.c @@ -13,8 +13,8 @@ static char *rcsid = "$Header$"; #include "adb.h" #include #include +#include -extern int errno; #define OPENLOCK(db, mode) \ { \ diff --git a/src/lib/kadm5/srv/server_dict.c b/src/lib/kadm5/srv/server_dict.c index 5b718d484..53df800b9 100644 --- a/src/lib/kadm5/srv/server_dict.c +++ b/src/lib/kadm5/srv/server_dict.c @@ -13,6 +13,7 @@ static char *rcsid = "$Header$"; #include #include #include +#include #include #include #include @@ -27,7 +28,7 @@ static char *rcsid = "$Header$"; static char **word_list = NULL; /* list of word pointers */ static char *word_block = NULL; /* actual word data */ static unsigned int word_count = 0; /* number of words */ -extern int errno; + /* * Function: word_compare diff --git a/src/lib/krb4/ChangeLog b/src/lib/krb4/ChangeLog index bff5f1c09..0b0a976c8 100644 --- a/src/lib/krb4/ChangeLog +++ b/src/lib/krb4/ChangeLog @@ -1,3 +1,9 @@ +2003-01-05 Sam Hartman + + * tf_util.c: Remove declaration of errno + + * dest_tkt.c (dest_tkt): Remove declaration of errno + 2002-12-18 Tom Yu * RealmsConfig-glue.c: Fix up KRB5_CALLCONV. diff --git a/src/lib/krb4/dest_tkt.c b/src/lib/krb4/dest_tkt.c index 5fd234443..676302509 100644 --- a/src/lib/krb4/dest_tkt.c +++ b/src/lib/krb4/dest_tkt.c @@ -69,7 +69,6 @@ dest_tkt() { const char *file = TKT_FILE; int i,fd; - extern int errno; int ret; struct stat statpre, statpost; char buf[BUFSIZ]; diff --git a/src/lib/krb4/tf_util.c b/src/lib/krb4/tf_util.c index 7de4b0ac4..6cb9eeb8f 100644 --- a/src/lib/krb4/tf_util.c +++ b/src/lib/krb4/tf_util.c @@ -47,7 +47,6 @@ #define TF_LCK_RETRY ((unsigned)2) /* seconds to sleep before * retry if ticket file is * locked */ -extern int errno; extern int krb_debug; void tf_close(); diff --git a/src/lib/krb5/posix/ChangeLog b/src/lib/krb5/posix/ChangeLog index 8112eb1d7..0a2cb1c81 100644 --- a/src/lib/krb5/posix/ChangeLog +++ b/src/lib/krb5/posix/ChangeLog @@ -1,3 +1,7 @@ +2003-01-05 Sam Hartman + + * syslog.c (vsyslog): Remove declaration of errno + 2002-08-29 Ken Raeburn * Makefile.in: Revert $(S)=>/ change, for Windows support. diff --git a/src/lib/krb5/posix/syslog.c b/src/lib/krb5/posix/syslog.c index 7188e36f9..3a02e8425 100644 --- a/src/lib/krb5/posix/syslog.c +++ b/src/lib/krb5/posix/syslog.c @@ -41,6 +41,7 @@ #define const #include #endif +#include #include #include #include @@ -89,7 +90,6 @@ vsyslog(pri, fmt, ap) const register char *fmt; va_list ap; { - extern int errno; register int cnt; register char *p; time_t now, time(); diff --git a/src/lib/rpc/ChangeLog b/src/lib/rpc/ChangeLog index 2a8bfe579..a3be9154c 100644 --- a/src/lib/rpc/ChangeLog +++ b/src/lib/rpc/ChangeLog @@ -1,3 +1,10 @@ +2003-01-05 Sam Hartman + + * svc_run.c svc_udp.c : Remove declaration of errno + + * clnt_udp.c pmap_getmaps.c pmap_rmt.c svc_auth_gssapi.c: Remove + declaration of errno + 2002-12-18 Ken Raeburn * auth_gssapi_misc.c (xdr_gss_buf, auth_gssapi_wrap_data, diff --git a/src/lib/rpc/clnt_udp.c b/src/lib/rpc/clnt_udp.c index 78102269e..6e20e5799 100644 --- a/src/lib/rpc/clnt_udp.c +++ b/src/lib/rpc/clnt_udp.c @@ -48,8 +48,8 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; #include #include #include +#include -extern int errno; /* * UDP bases client side rpc operations diff --git a/src/lib/rpc/pmap_getmaps.c b/src/lib/rpc/pmap_getmaps.c index 7f9020617..a4e1f9ca0 100644 --- a/src/lib/rpc/pmap_getmaps.c +++ b/src/lib/rpc/pmap_getmaps.c @@ -56,7 +56,6 @@ static char sccsid[] = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro"; #define NAMELEN 255 #define MAX_BROADCAST_SIZE 1400 -extern int errno; /* * Get a copy of the current port maps. diff --git a/src/lib/rpc/pmap_rmt.c b/src/lib/rpc/pmap_rmt.c index bc71ec060..3e82cea91 100644 --- a/src/lib/rpc/pmap_rmt.c +++ b/src/lib/rpc/pmap_rmt.c @@ -60,7 +60,6 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; #define MAX_BROADCAST_SIZE 1400 #include -extern int errno; static struct timeval timeout = { 3, 0 }; diff --git a/src/lib/rpc/svc_auth_gssapi.c b/src/lib/rpc/svc_auth_gssapi.c index d3a634a00..cb2844fc3 100644 --- a/src/lib/rpc/svc_auth_gssapi.c +++ b/src/lib/rpc/svc_auth_gssapi.c @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -114,7 +115,6 @@ typedef struct _client_list { static client_list *clients = NULL; -extern int errno; enum auth_stat _gssrpc_svcauth_gssapi(rqst, msg, no_dispatch) register struct svc_req *rqst; diff --git a/src/lib/rpc/svc_run.c b/src/lib/rpc/svc_run.c index ca48364a1..823b1d461 100644 --- a/src/lib/rpc/svc_run.c +++ b/src/lib/rpc/svc_run.c @@ -37,7 +37,7 @@ static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro"; * Wait for input, call server program. */ #include -#include +#include void svc_run() @@ -47,7 +47,6 @@ svc_run() #else int readfds; #endif /* def FD_SETSIZE */ - extern int errno; for (;;) { #ifdef FD_SETSIZE diff --git a/src/lib/rpc/svc_udp.c b/src/lib/rpc/svc_udp.c index 21b5c8f06..a1bcb86a9 100644 --- a/src/lib/rpc/svc_udp.c +++ b/src/lib/rpc/svc_udp.c @@ -74,7 +74,6 @@ static struct xp_ops svcudp_op = { svcudp_destroy }; -extern int errno; /* * kept in xprt->xp_p2 diff --git a/src/tests/dejagnu/ChangeLog b/src/tests/dejagnu/ChangeLog index a0a667753..51affdd6e 100644 --- a/src/tests/dejagnu/ChangeLog +++ b/src/tests/dejagnu/ChangeLog @@ -1,3 +1,7 @@ +2003-01-05 Sam Hartman + + * t_inetd.c: Remove declaration of errno + 2002-08-29 Ken Raeburn * Makefile.in: Revert $(S)=>/ change, for Windows support. diff --git a/src/tests/dejagnu/t_inetd.c b/src/tests/dejagnu/t_inetd.c index fba21da5e..80835b58b 100644 --- a/src/tests/dejagnu/t_inetd.c +++ b/src/tests/dejagnu/t_inetd.c @@ -55,7 +55,6 @@ #include "com_err.h" -extern int errno; char *progname; diff --git a/src/util/db2/ChangeLog b/src/util/db2/ChangeLog index c1d16e294..acbfb104e 100644 --- a/src/util/db2/ChangeLog +++ b/src/util/db2/ChangeLog @@ -1,3 +1,7 @@ +2003-01-05 Sam Hartman + + * clib/mkstemp.c (_gettemp): Remove declaration of errno + 2002-09-05 Ken Raeburn * configure.in: Check for stdint.h and inttypes.h. diff --git a/src/util/db2/clib/mkstemp.c b/src/util/db2/clib/mkstemp.c index 5b24b01a1..71dc7d17a 100644 --- a/src/util/db2/clib/mkstemp.c +++ b/src/util/db2/clib/mkstemp.c @@ -65,7 +65,6 @@ _gettemp(path, doopen) char *path; register int *doopen; { - extern int errno; register char *start, *trv; struct stat sbuf; u_int pid; diff --git a/src/util/db2/test/ChangeLog b/src/util/db2/test/ChangeLog index 042c84f9c..82072aa85 100644 --- a/src/util/db2/test/ChangeLog +++ b/src/util/db2/test/ChangeLog @@ -1,3 +1,7 @@ +2003-01-05 Sam Hartman + + * SEQ_TEST/t.c (main): Remove declaration of errno + 2002-08-29 Ken Raeburn * Makefile.in: Revert $(S)=>/ change, for Windows support. diff --git a/src/util/db2/test/Makefile b/src/util/db2/test/Makefile index 60b63dd53..6685decb5 100644 --- a/src/util/db2/test/Makefile +++ b/src/util/db2/test/Makefile @@ -125,12 +125,12 @@ CONFIG_RELTOPDIR = ../.. ALL_CFLAGS = $(DEFS) $(DEFINES) $(LOCALINCLUDES) $(CPPFLAGS) $(CFLAGS) CFLAGS = -g -CPPFLAGS = -I$(BUILDTOP)/include -I$(SRCTOP)/include -I$(BUILDTOP)/include/krb5 -I$(SRCTOP)/include/krb5 -DKRB5_KRB4_COMPAT -DKRB5_PRIVATE=1 +CPPFLAGS = -I$(BUILDTOP)/include -I$(SRCTOP)/include -I$(BUILDTOP)/include/krb5 -I$(SRCTOP)/include/krb5 -I/usr/athena/include -DKRB5_KRB4_COMPAT -DKRB5_PRIVATE=1 DEFS = -DHAVE_CONFIG_H CC = /usr/gcc/bin/gcc LD = $(PURE) /usr/gcc/bin/gcc DEPLIBS = @DEPLIBS@ -LDFLAGS = +LDFLAGS = -L/usr/athena/lib LD_UNRESOLVED_PREFIX = @LD_UNRESOLVED_PREFIX@ LD_SHLIBDIR_PREFIX = @LD_SHLIBDIR_PREFIX@ LDARGS = @LDARGS@ @@ -312,6 +312,13 @@ DB_DEPS-sys = DB_DEPS-k5 = $(BUILDTOP)/include/db.h $(BUILDTOP)/include/db-config.h DB_DEPS-redirect = $(BUILDTOP)/include/db.h +# Header file dependencies that might depend on whether krb4 support +# is compiled. + +KRB_ERR_H_DEP = $(BUILDTOP)/include/kerberosIV/krb_err.h +KRB524_H_DEP = $(BUILDTOP)/include/krb524.h +KRB524_ERR_H_DEP= $(BUILDTOP)/include/krb524_err.h + # LIBS gets substituted in... e.g. -lnsl -lsocket # GEN_LIB is -lgen if needed for regexp diff --git a/src/util/db2/test/SEQ_TEST/t.c b/src/util/db2/test/SEQ_TEST/t.c index 31262b2d9..f77b676f1 100644 --- a/src/util/db2/test/SEQ_TEST/t.c +++ b/src/util/db2/test/SEQ_TEST/t.c @@ -8,7 +8,6 @@ #include #include -extern int errno; void main(int argc, char *argv[]) { char id1[] = {" "}, id2[] = {" "}; diff --git a/src/util/ss/ChangeLog b/src/util/ss/ChangeLog index 844830000..431b0863f 100644 --- a/src/util/ss/ChangeLog +++ b/src/util/ss/ChangeLog @@ -1,3 +1,9 @@ +2003-01-05 Sam Hartman + + * pager.c: Remove declaration of errno + + * help.c: Remove declaration of errno + 2002-12-12 Tom Yu * Makefile.in (depend-dependencies): Was previously diff --git a/src/util/ss/help.c b/src/util/ss/help.c index 3c9cbec51..2752f40ed 100644 --- a/src/util/ss/help.c +++ b/src/util/ss/help.c @@ -6,13 +6,13 @@ #include #include +#include #include #include /* just for O_* */ #include #include "ss_internal.h" #include "copyright.h" -extern int errno; void ss_help (argc, argv, sci_idx, info_ptr) int argc; diff --git a/src/util/ss/pager.c b/src/util/ss/pager.c index 733119423..c8a52f079 100644 --- a/src/util/ss/pager.c +++ b/src/util/ss/pager.c @@ -9,6 +9,7 @@ #include "ss_internal.h" #include "copyright.h" +#include #include #include #include @@ -17,7 +18,6 @@ static char MORE[] = "more"; extern char *_ss_pager_name; extern char *getenv(); -extern int errno; /* * this needs a *lot* of work.... -- 2.26.2