Hello,

after staring at the client code in "src/tftp.c", I decided
that all externally scoped variables are in error. Their
ordinary declarations, present in the same file, are thus
straightened out to be "static" at the same time.

For Simon: "git help" never pointed me to "git format-patch".
           Thank you!

Best regards,

Mats E A
From ecb36a1fb0cf10ce765bc97ea3f497c266095bae Mon Sep 17 00:00:00 2001
From: Mats Erik Andersson <g...@gisladisker.se>
Date: Thu, 9 Sep 2010 19:00:07 +0200
Subject: [PATCH] src/tftp.c: Remove external scopes, making them static.

---
 ChangeLog  |    8 ++++++++
 src/tftp.c |   27 ++++++++++-----------------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2a6af30..7f3efb3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-09-09  Mats Erik Andersson <g...@gisladisker.se>
+
+	* src/tftp.c (peeraddr, f, trace, verbose, rexmtval)
+	(maxtimeout): Remove external scope.
+	(peeraddr, f, port, trace, verbose, connected): Upgrade
+	to static scope in file.
+	(rexmtval, maxtimeout): Static scope and new positioning.
+
 2010-09-03  Simon Josefsson  <si...@josefsson.org>
 
 	* doc/inetutils.texi (telnetd invocation): Use two spaces after
diff --git a/src/tftp.c b/src/tftp.c
index ec46039..6515976 100644
--- a/src/tftp.c
+++ b/src/tftp.c
@@ -79,13 +79,6 @@
 #include "progname.h"
 #include "tftpsubs.h"
 
-extern struct sockaddr_in peeraddr;	/* filled in by main */
-extern int f;			/* the opened socket */
-extern int trace;
-extern int verbose;
-extern int rexmtval;
-extern int maxtimeout;
-
 #define PKTSIZE    SEGSIZE+4
 char ackbuf[PKTSIZE];
 int timeout;
@@ -101,12 +94,16 @@ static void tpacket (const char *, struct tftphdr *, int);
 
 #define TIMEOUT		5	/* secs between rexmt's */
 
-struct sockaddr_in peeraddr;
-int f;
-short port;
-int trace;
-int verbose;
-int connected;
+static int rexmtval = TIMEOUT;
+static int maxtimeout = 5 * TIMEOUT;
+
+static struct sockaddr_in peeraddr;	/* filled in by main */
+static int f;			/* the opened socket */
+static short port;
+static int trace;
+static int verbose;
+static int connected;
+
 char mode[32];
 char line[200];
 int margc;
@@ -597,8 +594,6 @@ getusage (char *s)
   printf ("       %s file file ... file if connected\n", s);
 }
 
-int rexmtval = TIMEOUT;
-
 void
 setrexmt (int argc, char *argv[])
 {
@@ -619,8 +614,6 @@ setrexmt (int argc, char *argv[])
     rexmtval = t;
 }
 
-int maxtimeout = 5 * TIMEOUT;
-
 void
 settimeout (int argc, char *argv[])
 {
-- 
1.7.0

Attachment: signature.asc
Description: Digital signature

Reply via email to