nfs-utils/0009-Allow-compilation-to-succeed-with-fno-common.patch
2020-02-05 22:14:57 +00:00

60 lines
1.6 KiB
Diff

From 212832f065dac884a2e9bc858263d7735b6e2230 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Thu, 6 Feb 2020 08:59:13 +1100
Subject: [PATCH] Allow compilation to succeed with -fno-common
When compiled with -fno-common, global variables that are declared
multple times cause an error. With -fcommon (the default), they are
merged.
Declaring such variable multiple times is probably not a good idea, and
is definitely not necessary.
This patch changes all the global variables defined in include files to
be explicitly "extern", and where necessary, adds the variable
declaration to a suitable .c file.
To test, run
CFLAGS=-fno-common ./configure
make
Signed-off-by: NeilBrown <neilb@suse.de>
---
utils/mountd/v4root.c | 2 --
utils/statd/statd.c | 1 +
utils/statd/statd.h | 2 +-
3 files changed, 2 insertions(+), 3 deletions(-)
--- a/utils/mountd/v4root.c
+++ b/utils/mountd/v4root.c
@@ -28,8 +28,6 @@
#include "v4root.h"
#include "pseudoflavors.h"
-int v4root_needed;
-
static nfs_export pseudo_root = {
.m_next = NULL,
.m_client = NULL,
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -67,6 +67,7 @@ static struct option longopts[] =
};
extern void sm_prog_1 (struct svc_req *, register SVCXPRT *);
+stat_chge SM_stat_chge;
#ifdef SIMULATIONS
extern void simulator (int, char **);
--- a/utils/statd/statd.h
+++ b/utils/statd/statd.h
@@ -41,7 +41,7 @@ extern void load_state(void);
/*
* Host status structure and macros.
*/
-stat_chge SM_stat_chge;
+extern stat_chge SM_stat_chge;
#define MY_NAME SM_stat_chge.mon_name
#define MY_STATE SM_stat_chge.state