summaryrefslogtreecommitdiff
path: root/regress/lib/libc/glob
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2011-01-07 19:45:45 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2011-01-07 19:45:45 +0000
commitd66330be431fd8df894681ff9024bf7ff7017309 (patch)
tree80dcca35a9d823344561a11a65c5528a4d6e1be8 /regress/lib/libc/glob
parentfa08c1a7b3a8342ccacb2f82c2e1c1400bf6fbff (diff)
Remove an extraneous return statement with the wrong return value.
Fix some gcc warnings.
Diffstat (limited to 'regress/lib/libc/glob')
-rw-r--r--regress/lib/libc/glob/globtest.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/regress/lib/libc/glob/globtest.c b/regress/lib/libc/glob/globtest.c
index e47a728da81..325a7750f0c 100644
--- a/regress/lib/libc/glob/globtest.c
+++ b/regress/lib/libc/glob/globtest.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: globtest.c,v 1.2 2010/09/24 13:32:55 djm Exp $ */
+/* $OpenBSD: globtest.c,v 1.3 2011/01/07 19:45:44 millert Exp $ */
/*
* Public domain, 2008, Todd C. Miller <Todd.Miller@courtesan.com>
@@ -17,7 +17,7 @@ struct gl_entry {
int nresults;
char pattern[1024];
char *results[MAX_RESULTS];
- long modes[MAX_RESULTS];
+ mode_t modes[MAX_RESULTS];
};
int test_glob(struct gl_entry *);
@@ -26,9 +26,8 @@ int
main(int argc, char **argv)
{
FILE *fp = stdin;
- char *buf, *cp, *want, *got, *last;
- const char *errstr;
- int errors = 0, i, lineno, mode;
+ char *buf, *cp;
+ int errors = 0, lineno, mode;
struct gl_entry entry;
size_t len;
@@ -94,7 +93,7 @@ main(int argc, char **argv)
mode = strtol(cp, NULL, 8);
} else
mode = -1;
- entry.modes[entry.nresults] = mode;
+ entry.modes[entry.nresults] = (mode_t)mode;
entry.results[entry.nresults++] = strdup(buf);
}
if (entry.pattern[0])
@@ -105,7 +104,7 @@ main(int argc, char **argv)
int test_glob(struct gl_entry *entry)
{
glob_t gl;
- int i;
+ int i = 0;
if (glob(entry->pattern, entry->flags, NULL, &gl) != 0)
errx(1, "glob failed: %s", entry->pattern);
@@ -139,6 +138,5 @@ int test_glob(struct gl_entry *entry)
while (i < gl.gl_matchc) {
free(entry->results[i++]);
}
- return (0);
return (1);
}