Merge pull request #9 from Nebuleon/patch

An unsigned char fix and an errno change
This commit is contained in:
Dave Murphy 2016-12-22 04:40:39 +00:00 committed by GitHub
commit d4926573ac
2 changed files with 3 additions and 3 deletions

View File

@ -98,7 +98,8 @@ static int _FAT_directory_lfnLength (const char* name) {
} }
// Make sure the name doesn't contain any control codes or codes not representable in UCS-2 // Make sure the name doesn't contain any control codes or codes not representable in UCS-2
for (i = 0; i < nameLength; i++) { for (i = 0; i < nameLength; i++) {
if (name[i] < 0x20 || name[i] >= ABOVE_UCS_RANGE) { unsigned char ch = (unsigned char) name[i];
if (ch < 0x20 || ch >= ABOVE_UCS_RANGE) {
return -1; return -1;
} }
} }

View File

@ -136,7 +136,7 @@ int _FAT_unlink_r (struct _reent *r, const char *path) {
if (!_FAT_directory_isDot (&dirContents)) { if (!_FAT_directory_isDot (&dirContents)) {
// The directory had something in it that isn't a reference to itself or it's parent // The directory had something in it that isn't a reference to itself or it's parent
_FAT_unlock(&partition->lock); _FAT_unlock(&partition->lock);
r->_errno = EPERM; r->_errno = ENOTEMPTY;
return -1; return -1;
} }
nextEntry = _FAT_directory_getNextEntry (partition, &dirContents); nextEntry = _FAT_directory_getNextEntry (partition, &dirContents);
@ -588,7 +588,6 @@ int _FAT_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filename, struct
// Make sure there is another file to report on // Make sure there is another file to report on
if (! state->validEntry) { if (! state->validEntry) {
_FAT_unlock(&state->partition->lock); _FAT_unlock(&state->partition->lock);
r->_errno = ENOENT;
return -1; return -1;
} }