Skip to content

Commit

Permalink
display error when directory does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanklee committed Jan 14, 2015
1 parent 6d6deeb commit 4dcad7a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ngp.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static int is_file(int index)

static int is_dir_good(char *dir)
{
return strcmp(dir, ".") != 0 &&
return *dir != '.' &&
strcmp(dir, "..") != 0 &&
strcmp(dir, ".git") != 0 ? 1 : 0;
}
Expand Down Expand Up @@ -797,7 +797,15 @@ static void configuration_init(config_t *cfg)

void * lookup_thread(void *arg)
{
DIR *dp;

search_t *d = (search_t *) arg;
dp = opendir(d->directory);

if (!dp) {
fprintf(stderr, "error: coult not open directory \"%s\"\n", d->directory);
exit(-1);
}

lookup_directory(d->directory, d->pattern, d->options);
d->status = 0;
Expand Down

0 comments on commit 4dcad7a

Please sign in to comment.