From 6b0e3194e38d1a9aa6cda892251c6a716e42c974 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 12 Jul 2007 00:42:09 +0000 Subject: r23847: As Dr. Volker says, "A pstring a day....". Jeremy. (This used to be commit 8adf81696aee99c5090e1b827ceb14929ec4aeda) --- source3/lib/util.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 2fafee23c9..5d583f25c3 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1856,8 +1856,7 @@ const char *readdirname(SMB_STRUCT_DIR *p) BOOL is_in_path(const char *name, name_compare_entry *namelist, BOOL case_sensitive) { - pstring last_component; - char *p; + const char *last_component; /* if we have no list it's obviously not in the path */ if((namelist == NULL ) || ((namelist != NULL) && (namelist[0].name == NULL))) { @@ -1867,8 +1866,12 @@ BOOL is_in_path(const char *name, name_compare_entry *namelist, BOOL case_sensit DEBUG(8, ("is_in_path: %s\n", name)); /* Get the last component of the unix name. */ - p = strrchr_m(name, '/'); - pstrcpy(last_component, p ? ++p : name); + last_component = strrchr_m(name, '/'); + if (!last_component) { + last_component = name; + } else { + last_component++; /* Go past '/' */ + } for(; namelist->name != NULL; namelist++) { if(namelist->is_wild) { @@ -1885,7 +1888,6 @@ BOOL is_in_path(const char *name, name_compare_entry *namelist, BOOL case_sensit } } DEBUG(8,("is_in_path: match not found\n")); - return False; } @@ -2774,7 +2776,7 @@ BOOL ms_has_wild_w(const smb_ucs2_t *s) of the ".." name. *******************************************************************/ -BOOL mask_match(const char *string, char *pattern, BOOL is_case_sensitive) +BOOL mask_match(const char *string, const char *pattern, BOOL is_case_sensitive) { if (strcmp(string,"..") == 0) string = "."; @@ -2790,7 +2792,7 @@ BOOL mask_match(const char *string, char *pattern, BOOL is_case_sensitive) pattern translation. *******************************************************************/ -BOOL mask_match_search(const char *string, char *pattern, BOOL is_case_sensitive) +BOOL mask_match_search(const char *string, const char *pattern, BOOL is_case_sensitive) { if (strcmp(string,"..") == 0) string = "."; -- cgit