From 1e6b04ccf9e6a172cf09d9116ab9d294ab0a7986 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <rem@videolan.org>
Date: Mon, 5 Dec 2005 20:53:56 +0000
Subject: [PATCH] - Don't print a bogus warning when reading on empty line in a
 .host file - Move acl.c to a more appropriate location

---
 Makefile.am                          |  2 +-
 po/POTFILES.in                       |  1 +
 src/{stream_output => network}/acl.c | 11 +++++++----
 3 files changed, 9 insertions(+), 5 deletions(-)
 rename src/{stream_output => network}/acl.c (99%)

diff --git a/Makefile.am b/Makefile.am
index 3ff67dc24783..481a75fe265d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -431,11 +431,11 @@ SOURCES_libvlc_common = \
 	src/stream_output/stream_output.c \
 	src/stream_output/announce.c \
 	src/stream_output/sap.c \
-	src/stream_output/acl.c \
 	src/osd/osd.c \
 	src/osd/osd_parser.c \
 	src/osd/osd_text.c \
 	src/osd/osd_widgets.c \
+	src/network/acl.c \
 	src/network/getaddrinfo.c \
 	src/network/io.c \
 	src/network/tcp.c \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 87825998151d..9ad33932b38b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -122,6 +122,7 @@ src/misc/variables.c
 src/misc/vlm.c
 src/misc/win32_specific.c
 src/misc/xml.c
+src/network/acl.c
 src/network/getaddrinfo.c
 src/network/httpd.c
 src/network/io.c
diff --git a/src/stream_output/acl.c b/src/network/acl.c
similarity index 99%
rename from src/stream_output/acl.c
rename to src/network/acl.c
index 9a957d1a7a50..b9cc0a63f7de 100644
--- a/src/stream_output/acl.c
+++ b/src/network/acl.c
@@ -66,7 +66,7 @@ static int ACL_Resolve( vlc_object_t *p_this, uint8_t *p_bytes,
         msg_Err( p_this, "invalid IP address %s", psz_ip );
         return -1;
     }
-    
+
     p_bytes[16] = 0; /* avoids overflowing when i_bytes_match = 16 */
 
     i_family = res->ai_addr->sa_family;
@@ -75,7 +75,7 @@ static int ACL_Resolve( vlc_object_t *p_this, uint8_t *p_bytes,
         case AF_INET:
         {
             struct sockaddr_in *addr;
-                
+
             addr = (struct sockaddr_in *)res->ai_addr;
             memset( p_bytes, 0, 12 );
             memcpy( p_bytes + 12, &addr->sin_addr, 4 );
@@ -203,7 +203,7 @@ vlc_acl_t *__ACL_Create( vlc_object_t *p_this, vlc_bool_t b_allow )
     p_acl->i_size = 0;
     p_acl->p_entries = NULL;
     p_acl->b_allow_default = b_allow;
-    
+
     return p_acl;
 }
 
@@ -264,7 +264,7 @@ void ACL_Destroy( vlc_acl_t *p_acl )
 int ACL_LoadFile( vlc_acl_t *p_acl, const char *psz_path )
 {
     FILE *file;
-    
+
     if( p_acl == NULL )
         return -1;
 
@@ -296,6 +296,9 @@ int ACL_LoadFile( vlc_acl_t *p_acl, const char *psz_path )
         while( isspace( *psz_ip ) )
             psz_ip++;
 
+        if( *psz_ip == '\0' ) /* empty/blank line */
+            continue;
+
         ptr = strchr( psz_ip, '\n' );
         if( ptr == NULL )
         {
-- 
GitLab