SQLite

Check-in [26dd42b462]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix handling of initial hidden and/or system files in the opendir() implementation for Windows. No changes to non-test code.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 26dd42b462dc621b8b0a2295fc91d3e61ac732b6
User & Date: mistachkin 2017-01-18 22:16:20.672
Context
2017-01-18
22:16
Make the vtabH-3.1 test more portable and robust. (check-in: d3c91c1fb3 user: mistachkin tags: trunk)
22:16
Fix handling of initial hidden and/or system files in the opendir() implementation for Windows. No changes to non-test code. (check-in: 26dd42b462 user: mistachkin tags: trunk)
2017-01-17
10:41
Fix a problem that could cause a spurious SQLITE_NOMEM error when attempting to resume an RBU operation if the previous client failed right after completing the incremental checkpoint. Also a "cannot vacuum wal db" error that could occur when resuming an RBU vacuum if an error (OOM or IO error) occurs during the incremental checkpoint. (check-in: 681d96eb82 user: dan tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/test_windirent.c.
59
60
61
62
63
64
65

66
67
68
69
70
71
72
73
74

75



76
77
78
79




80
81
82
83
84
85
86
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94







+








-
+

+
+
+




+
+
+
+







  memset(dirp, 0, sizeof(DIR));

  /* TODO: Remove this if Unix-style root paths are not used. */
  if( sqlite3_stricmp(dirname, "/")==0 ){
    dirname = windirent_getenv("SystemDrive");
  }

  memset(&data, 0, sizeof(struct _finddata_t));
  _snprintf(data.name, namesize, "%s\\*", dirname);
  dirp->d_handle = _findfirst(data.name, &data);

  if( dirp->d_handle==BAD_INTPTR_T ){
    closedir(dirp);
    return NULL;
  }

  /* TODO: Remove this block to allow hidden and system files. */
  /* TODO: Remove this block to allow hidden and/or system files. */
  if( data.attrib&_A_HIDDEN || data.attrib&_A_SYSTEM ){
next:

    memset(&data, 0, sizeof(struct _finddata_t));
    if( _findnext(dirp->d_handle, &data)==-1 ){
      closedir(dirp);
      return NULL;
    }

    /* TODO: Remove this block to allow hidden and/or system files. */
    if( data.attrib&_A_HIDDEN ) goto next;
    if( data.attrib&_A_SYSTEM ) goto next;
  }

  dirp->d_first.d_attributes = data.attrib;
  strncpy(dirp->d_first.d_name, data.name, NAME_MAX);
  dirp->d_first.d_name[NAME_MAX] = '\0';

  return dirp;
101
102
103
104
105
106
107

108
109
110

111
112
113
114
115
116
117
109
110
111
112
113
114
115
116
117
118

119
120
121
122
123
124
125
126







+


-
+







    dirp->d_next.d_ino++;

    return &dirp->d_first;
  }

next:

  memset(&data, 0, sizeof(struct _finddata_t));
  if( _findnext(dirp->d_handle, &data)==-1 ) return NULL;

  /* TODO: Remove this block to allow hidden and system files. */
  /* TODO: Remove this block to allow hidden and/or system files. */
  if( data.attrib&_A_HIDDEN ) goto next;
  if( data.attrib&_A_SYSTEM ) goto next;

  dirp->d_next.d_ino++;
  dirp->d_next.d_attributes = data.attrib;
  strncpy(dirp->d_next.d_name, data.name, NAME_MAX);
  dirp->d_next.d_name[NAME_MAX] = '\0';
142
143
144
145
146
147
148

149
150
151
152
153
154

155
156
157
158
159
160
161
151
152
153
154
155
156
157
158
159
160
161
162
163

164
165
166
167
168
169
170
171







+





-
+








    *result = entry;
    return 0;
  }

next:

  memset(&data, 0, sizeof(struct _finddata_t));
  if( _findnext(dirp->d_handle, &data)==-1 ){
    *result = NULL;
    return ENOENT;
  }

  /* TODO: Remove this block to allow hidden and system files. */
  /* TODO: Remove this block to allow hidden and/or system files. */
  if( data.attrib&_A_HIDDEN ) goto next;
  if( data.attrib&_A_SYSTEM ) goto next;

  entry->d_ino = (ino_t)-1; /* not available */
  entry->d_attributes = data.attrib;
  strncpy(entry->d_name, data.name, NAME_MAX);
  entry->d_name[NAME_MAX] = '\0';