Author: kevans
Date: Mon Apr  6 23:16:05 2020
New Revision: 359677
URL: https://svnweb.freebsd.org/changeset/base/359677

Log:
  yp*: fix -fno-common build
  
  This is mostly two problems spread out far and wide:
  - ypldap_process should be declared properly
  - debug is defined differently in many programs
  
  For the latter, just extern it and define it everywhere that actually needs
  it. This mostly works out nicely for ^/libexec/ypxfr, which can remove the
  assignment at the beginning of main in favor of defining it properly.
  
  -fno-common will become the default in GCC10/LLVM11.
  
  MFC after:    3 days

Modified:
  head/libexec/ypxfr/ypxfr_main.c
  head/usr.sbin/rpc.yppasswdd/yppasswdd_main.c
  head/usr.sbin/rpc.ypupdated/ypupdated_main.c
  head/usr.sbin/rpc.ypxfrd/ypxfrd_main.c
  head/usr.sbin/ypldap/ypldap.c
  head/usr.sbin/ypldap/ypldap.h
  head/usr.sbin/ypserv/yp_access.c
  head/usr.sbin/ypserv/yp_error.c
  head/usr.sbin/ypserv/yp_main.c

Modified: head/libexec/ypxfr/ypxfr_main.c
==============================================================================
--- head/libexec/ypxfr/ypxfr_main.c     Mon Apr  6 23:11:43 2020        
(r359676)
+++ head/libexec/ypxfr/ypxfr_main.c     Mon Apr  6 23:16:05 2020        
(r359677)
@@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$");
 #include <rpcsvc/ypxfrd.h>
 #include "ypxfr_extern.h"
 
+int debug = 1;
+
 char *progname = "ypxfr";
 char *yp_dir = _PATH_YP;
 int _rpcpmstart = 0;
@@ -175,8 +177,6 @@ main(int argc, char *argv[])
        int remoteport;
        int interdom = 0;
        int secure = 0;
-
-       debug = 1;
 
        if (!isatty(fileno(stderr))) {
                openlog("ypxfr", LOG_PID, LOG_DAEMON);

Modified: head/usr.sbin/rpc.yppasswdd/yppasswdd_main.c
==============================================================================
--- head/usr.sbin/rpc.yppasswdd/yppasswdd_main.c        Mon Apr  6 23:11:43 
2020        (r359676)
+++ head/usr.sbin/rpc.yppasswdd/yppasswdd_main.c        Mon Apr  6 23:16:05 
2020        (r359677)
@@ -83,6 +83,7 @@ static int _rpcfdtype;
 #define        _IDLE 0
 #define        _SERVED 1
 #define        _SERVING 2
+int debug;
 
 static char _localhost[] = "localhost";
 static char _passwd_byname[] = "passwd.byname";
@@ -172,8 +173,6 @@ main(int argc, char *argv[])
        char *mastername;
        char myname[MAXHOSTNAMELEN + 2];
        int maxrec = RPC_MAXDATASIZE;
-
-       extern int debug;
 
        debug = 1;
 

Modified: head/usr.sbin/rpc.ypupdated/ypupdated_main.c
==============================================================================
--- head/usr.sbin/rpc.ypupdated/ypupdated_main.c        Mon Apr  6 23:11:43 
2020        (r359676)
+++ head/usr.sbin/rpc.ypupdated/ypupdated_main.c        Mon Apr  6 23:16:05 
2020        (r359677)
@@ -76,6 +76,8 @@ static int _rpcfdtype;
 
 extern int _rpcsvcstate;        /* Set when a request is serviced */
 
+int debug;
+
 char *progname = "rpc.ypupdated";
 char *yp_dir = "/var/yp/";
 

Modified: head/usr.sbin/rpc.ypxfrd/ypxfrd_main.c
==============================================================================
--- head/usr.sbin/rpc.ypxfrd/ypxfrd_main.c      Mon Apr  6 23:11:43 2020        
(r359676)
+++ head/usr.sbin/rpc.ypxfrd/ypxfrd_main.c      Mon Apr  6 23:16:05 2020        
(r359677)
@@ -78,6 +78,8 @@ static int _rpcfdtype;
 
 extern int _rpcsvcstate;        /* Set when a request is serviced */
 
+int debug;
+
 char *progname = "rpc.ypxfrd";
 char *yp_dir = "/var/yp/";
 

Modified: head/usr.sbin/ypldap/ypldap.c
==============================================================================
--- head/usr.sbin/ypldap/ypldap.c       Mon Apr  6 23:11:43 2020        
(r359676)
+++ head/usr.sbin/ypldap/ypldap.c       Mon Apr  6 23:16:05 2020        
(r359677)
@@ -40,6 +40,8 @@
 
 #include "ypldap.h"
 
+enum ypldap_process_type               ypldap_process;
+
 __dead2 void    usage(void);
 int             check_child(pid_t, const char *);
 void            main_sig_handler(int, short, void *);

Modified: head/usr.sbin/ypldap/ypldap.h
==============================================================================
--- head/usr.sbin/ypldap/ypldap.h       Mon Apr  6 23:11:43 2020        
(r359676)
+++ head/usr.sbin/ypldap/ypldap.h       Mon Apr  6 23:16:05 2020        
(r359677)
@@ -47,10 +47,11 @@ struct ypldap_addr {
 };
 TAILQ_HEAD(ypldap_addr_list, ypldap_addr);
 
-enum {
+enum ypldap_process_type {
        PROC_MAIN,
        PROC_CLIENT
-} ypldap_process;
+};
+extern enum ypldap_process_type                ypldap_process;
 
 struct userent {
        RB_ENTRY(userent)                ue_name_node;

Modified: head/usr.sbin/ypserv/yp_access.c
==============================================================================
--- head/usr.sbin/ypserv/yp_access.c    Mon Apr  6 23:11:43 2020        
(r359676)
+++ head/usr.sbin/ypserv/yp_access.c    Mon Apr  6 23:16:05 2020        
(r359677)
@@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$");
 #include "tcpd.h"
 #endif
 
-extern int debug;
-
 static const char *yp_procs[] = {
        /* NIS v1 */
        "ypoldproc_null",

Modified: head/usr.sbin/ypserv/yp_error.c
==============================================================================
--- head/usr.sbin/ypserv/yp_error.c     Mon Apr  6 23:11:43 2020        
(r359676)
+++ head/usr.sbin/ypserv/yp_error.c     Mon Apr  6 23:16:05 2020        
(r359677)
@@ -47,8 +47,6 @@ __FBSDID("$FreeBSD$");
 #include <syslog.h>
 #include "yp_extern.h"
 
-int debug;
-
 extern int _rpcpmstart;
 extern char *progname;
 static void __verr(const char *fmt, va_list ap) __printflike(1, 0);

Modified: head/usr.sbin/ypserv/yp_main.c
==============================================================================
--- head/usr.sbin/ypserv/yp_main.c      Mon Apr  6 23:11:43 2020        
(r359676)
+++ head/usr.sbin/ypserv/yp_main.c      Mon Apr  6 23:16:05 2020        
(r359677)
@@ -89,7 +89,7 @@ extern int _rpc_dtablesize(void);
 extern int _rpcsvcstate;        /* Set when a request is serviced */
 char *progname = "ypserv";
 char *yp_dir = _PATH_YP;
-/*int debug = 0;*/
+int debug;
 int do_dns = 0;
 int resfd;
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to