~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cached_directory.cc

  • Committer: Brian Aker
  • Date: 2010-09-13 21:43:18 UTC
  • mto: (1768.2.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 1770.
  • Revision ID: brian@tangent.org-20100913214318-b5tdvn64qvtvybnj
Use full path for opening up directory files when checking for types.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
#include "config.h"
29
29
 
 
30
#include "drizzled/definitions.h"
 
31
 
30
32
#include <sys/types.h>
31
33
#include <sys/stat.h>
32
34
#include <unistd.h>
125
127
  while ((retcode= readdir_r(dirp, &buffer.entry, &result)) == 0 &&
126
128
         result != NULL)
127
129
  {
 
130
    std::string buffered_fullpath;
128
131
    if (! allowed_exts.empty())
129
132
    {
130
133
      char *ptr= rindex(result->d_name, '.');
148
151
        {
149
152
          struct stat entrystat;
150
153
 
151
 
          if (result->d_name[0] == '.')
 
154
          if (result->d_name[0] == '.') // We don't pass back anything hidden at the moment.
152
155
            continue;
153
156
 
154
 
          stat(result->d_name, &entrystat);
 
157
          buffered_fullpath.append(in_path);
 
158
          if (buffered_fullpath[buffered_fullpath.length()] != '/')
 
159
            buffered_fullpath.append(1, FN_LIBCHAR);
 
160
 
 
161
          buffered_fullpath.assign(result->d_name);
 
162
 
 
163
          stat(buffered_fullpath.c_str(), &entrystat);
155
164
 
156
165
          if (S_ISDIR(entrystat.st_mode))
157
166
          {
163
172
        {
164
173
          struct stat entrystat;
165
174
 
166
 
          stat(result->d_name, &entrystat);
 
175
          buffered_fullpath.append(in_path);
 
176
          if (buffered_fullpath[buffered_fullpath.length()] != '/')
 
177
            buffered_fullpath.append(1, FN_LIBCHAR);
 
178
 
 
179
          buffered_fullpath.assign(result->d_name);
 
180
 
 
181
          stat(buffered_fullpath.c_str(), &entrystat);
167
182
 
168
183
          if (S_ISREG(entrystat.st_mode))
169
184
          {