diff options
author | James Peach <jpeach@samba.org> | 2006-04-24 00:16:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:04:14 -0500 |
commit | 6ab33938d5239e8688440f65e802f627622d301b (patch) | |
tree | 7c2253d8e3252ccd973b2d2d36754d0d0e196d7a /source4/torture | |
parent | f380d365eaad89db2c46331a3fa2d5d8600aeba1 (diff) | |
download | samba-6ab33938d5239e8688440f65e802f627622d301b.tar.gz samba-6ab33938d5239e8688440f65e802f627622d301b.tar.bz2 samba-6ab33938d5239e8688440f65e802f627622d301b.zip |
r15186: Introduce ISDOT and ISDOTDOT macros for testing whether a filename is
"." for "..". These express the intention better that strcmp or strequal
and improve searchability via cscope/ctags.
(This used to be commit 7e4ad7e8e5ec266b969e3075c4ad7f021571f24e)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/basic/mangle_test.c | 3 | ||||
-rw-r--r-- | source4/torture/masktest.c | 15 |
2 files changed, 10 insertions, 8 deletions
diff --git a/source4/torture/basic/mangle_test.c b/source4/torture/basic/mangle_test.c index 5eb00c076f..5f2a07e02f 100644 --- a/source4/torture/basic/mangle_test.c +++ b/source4/torture/basic/mangle_test.c @@ -21,6 +21,7 @@ #include "includes.h" #include "torture/torture.h" #include "system/filesys.h" +#include "system/dir.h" #include "lib/tdb/include/tdbutil.h" #include "libcli/libcli.h" #include "torture/util.h" @@ -130,7 +131,7 @@ static void gen_name(char *name) p[i] = 0; - if (strcmp(p, ".") == 0 || strcmp(p, "..") == 0) { + if (ISDOT(p) || ISDOTDOT(p)) { p[0] = '_'; } diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index c37efc0472..6e2678ed80 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -20,6 +20,7 @@ #include "includes.h" #include "system/filesys.h" +#include "system/dir.h" #include "libcli/libcli.h" #include "libcli/raw/libcliraw.h" #include "system/time.h" @@ -41,9 +42,9 @@ static BOOL reg_match_one(struct smbcli_state *cli, const char *pattern, const c /* oh what a weird world this is */ if (old_list && strcmp(pattern, "*.*") == 0) return True; - if (strcmp(pattern,".") == 0) return False; + if (ISDOT(pattern)) return False; - if (strcmp(file,"..") == 0) file = "."; + if (ISDOTDOT(file)) file = "."; return ms_fnmatch(pattern, file, cli->transport->negotiate.protocol)==0; } @@ -101,9 +102,9 @@ static BOOL f_info_hit; static void listfn(struct clilist_file_info *f, const char *s, void *state) { - if (strcmp(f->name,".") == 0) { + if (ISDOT(f->name)) { resultp[0] = '+'; - } else if (strcmp(f->name,"..") == 0) { + } else if (ISDOTDOT(f->name)) { resultp[1] = '+'; } else { resultp[2] = '+'; @@ -227,9 +228,9 @@ static void test_mask(int argc, char *argv[], } file[l+l2] = 0; - if (strcmp(file+l,".") == 0 || - strcmp(file+l,"..") == 0 || - strcmp(mask+l,"..") == 0) continue; + if (ISDOT(file+l) || ISDOTDOT(file+l) || ISDOTDOT(mask+l)) { + continue; + } if (strspn(file+l, ".") == strlen(file+l)) continue; |