From a3859b5e09e9cac7212837d066be4a720eefddaa Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Wed, 14 Nov 2012 11:40:31 +0100
Subject: [PATCH] runtests and friends: Do not add undefined values to @INC

On FreeBSD this fixes the warning:
Use of uninitialized value $p in string eq at /usr/local/lib/perl5/5.14.2/BSDPAN/BSDPAN.pm line 36.
---
 tests/ftpserver.pl    | 3 ++-
 tests/httpserver.pl   | 3 ++-
 tests/keywords.pl     | 3 ++-
 tests/rtspserver.pl   | 3 ++-
 tests/runtests.pl     | 3 ++-
 tests/secureserver.pl | 3 ++-
 tests/tftpserver.pl   | 3 ++-
 7 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index 6e6f691..45b3436 100755
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -39,7 +39,8 @@
 #
 
 BEGIN {
-    @INC=(@INC, $ENV{'srcdir'}, '.');
+    push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
+    push(@INC, ".");
     # sub second timestamping needs Time::HiRes
     eval {
         no warnings "all";
diff --git a/tests/httpserver.pl b/tests/httpserver.pl
index d5c4dfb..a38c3ce 100755
--- a/tests/httpserver.pl
+++ b/tests/httpserver.pl
@@ -22,7 +22,8 @@
 #***************************************************************************
 
 BEGIN {
-    @INC=(@INC, $ENV{'srcdir'}, '.');
+    push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
+    push(@INC, ".");
 }
 
 use strict;
diff --git a/tests/keywords.pl b/tests/keywords.pl
index 523bde1..28646ad 100755
--- a/tests/keywords.pl
+++ b/tests/keywords.pl
@@ -23,7 +23,8 @@
 
 use strict;
 
-@INC=(@INC, $ENV{'srcdir'}, ".");
+push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
+push(@INC, ".");
 
 require "getpart.pm"; # array functions
 
diff --git a/tests/rtspserver.pl b/tests/rtspserver.pl
index 515128d..07a588e 100755
--- a/tests/rtspserver.pl
+++ b/tests/rtspserver.pl
@@ -22,7 +22,8 @@
 #***************************************************************************
 
 BEGIN {
-    @INC=(@INC, $ENV{'srcdir'}, '.');
+    push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
+    push(@INC, ".");
 }
 
 use strict;
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 27fff4a..0b2559e 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -56,7 +56,8 @@
 # These should be the only variables that might be needed to get edited:
 
 BEGIN {
-    @INC=(@INC, $ENV{'srcdir'}, ".");
+    push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
+    push(@INC, ".");
     # run time statistics needs Time::HiRes
     eval {
         no warnings "all";
diff --git a/tests/secureserver.pl b/tests/secureserver.pl
index 064fa84..36a902e 100755
--- a/tests/secureserver.pl
+++ b/tests/secureserver.pl
@@ -26,7 +26,8 @@
 # non-secure test harness servers.
 
 BEGIN {
-    @INC=(@INC, $ENV{'srcdir'}, '.');
+    push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
+    push(@INC, ".");
 }
 
 use strict;
diff --git a/tests/tftpserver.pl b/tests/tftpserver.pl
index c5382ec..60fc32d 100755
--- a/tests/tftpserver.pl
+++ b/tests/tftpserver.pl
@@ -22,7 +22,8 @@
 #***************************************************************************
 
 BEGIN {
-    @INC=(@INC, $ENV{'srcdir'}, '.');
+    push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'});
+    push(@INC, ".");
 }
 
 use strict;
-- 
1.8.0


