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
This commit is contained in:
kevans 2020-04-06 23:16:05 +00:00
parent 3f665071ef
commit 008e530970
9 changed files with 13 additions and 11 deletions

View File

@ -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;
@ -176,8 +178,6 @@ main(int argc, char *argv[])
int interdom = 0;
int secure = 0;
debug = 1;
if (!isatty(fileno(stderr))) {
openlog("ypxfr", LOG_PID, LOG_DAEMON);
_rpcpmstart = 1;

View File

@ -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";
@ -173,8 +174,6 @@ main(int argc, char *argv[])
char myname[MAXHOSTNAMELEN + 2];
int maxrec = RPC_MAXDATASIZE;
extern int debug;
debug = 1;
while ((ch = getopt(argc, argv, "t:d:p:sfamuivh")) != -1) {

View File

@ -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/";

View File

@ -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/";

View File

@ -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 *);

View File

@ -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;

View File

@ -57,8 +57,6 @@ __FBSDID("$FreeBSD$");
#include "tcpd.h"
#endif
extern int debug;
static const char *yp_procs[] = {
/* NIS v1 */
"ypoldproc_null",

View File

@ -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);

View File

@ -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;