diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-12-18 16:35:19 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-12-18 16:48:03 +0100 |
commit | 6f96c4d2651ed59975354433267319d527490537 (patch) | |
tree | 8ba1e1d90146ab943725c42d1e24c708a1f93328 /lib | |
parent | 2262af9f82d8a07751acea042844906649053a9f (diff) |
Move is_filename_sane to libfstree, add test cases
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common/Makemodule.am | 2 | ||||
-rw-r--r-- | lib/fstree/Makemodule.am | 1 | ||||
-rw-r--r-- | lib/fstree/filename_sane.c (renamed from lib/common/filename_sane.c) | 7 |
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/common/Makemodule.am b/lib/common/Makemodule.am index e97085b..696a169 100644 --- a/lib/common/Makemodule.am +++ b/lib/common/Makemodule.am @@ -5,7 +5,7 @@ libcommon_a_SOURCES += lib/common/compress.c lib/common/comp_opt.c libcommon_a_SOURCES += lib/common/data_writer.c include/common.h libcommon_a_SOURCES += lib/common/get_path.c lib/common/io_stdin.c libcommon_a_SOURCES += lib/common/writer.c lib/common/perror.c -libcommon_a_SOURCES += lib/common/mkdir_p.c lib/common/filename_sane.c +libcommon_a_SOURCES += lib/common/mkdir_p.c libcommon_a_CFLAGS = $(AM_CFLAGS) $(LZO_CFLAGS) if WITH_LZO diff --git a/lib/fstree/Makemodule.am b/lib/fstree/Makemodule.am index 33b508c..31bcb31 100644 --- a/lib/fstree/Makemodule.am +++ b/lib/fstree/Makemodule.am @@ -6,6 +6,7 @@ libfstree_a_SOURCES += lib/fstree/add_by_path.c libfstree_a_SOURCES += include/fstree.h lib/fstree/internal.h libfstree_a_SOURCES += lib/fstree/source_date_epoch.c libfstree_a_SOURCES += lib/fstree/canonicalize_name.c +libfstree_a_SOURCES += lib/fstree/filename_sane.c libfstree_a_CFLAGS = $(AM_CFLAGS) libfstree_a_CPPFLAGS = $(AM_CPPFLAGS) diff --git a/lib/common/filename_sane.c b/lib/fstree/filename_sane.c index 56f1127..b0f8c90 100644 --- a/lib/common/filename_sane.c +++ b/lib/fstree/filename_sane.c @@ -4,11 +4,12 @@ * * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> */ -#include "common.h" +#include "config.h" +#include "fstree.h" #include <string.h> -#ifdef _WIN32 +#if defined(_WIN32) || defined(__WINDOWS__) || defined(TEST_WIN32) #ifdef _MSC_VER #define strncasecmp _strnicmp #define strcasecmp _stricmp @@ -59,7 +60,7 @@ bool is_filename_sane(const char *name, bool check_os_specific) if (*name == '/' || *name == '\\') return false; -#ifdef _WIN32 +#if defined(_WIN32) || defined(__WINDOWS__) || defined(TEST_WIN32) if (check_os_specific) { if (*name == '<' || *name == '>' || *name == ':') return false; |