Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.

Commit d492657

Browse files
authored
Merge pull request #9 from Nebuleon/patch
An unsigned char fix and an errno change
2 parents 73ccaec + b7c4d38 commit d492657

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

source/directory.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ static int _FAT_directory_lfnLength (const char* name) {
9898
}
9999
// Make sure the name doesn't contain any control codes or codes not representable in UCS-2
100100
for (i = 0; i < nameLength; i++) {
101-
if (name[i] < 0x20 || name[i] >= ABOVE_UCS_RANGE) {
101+
unsigned char ch = (unsigned char) name[i];
102+
if (ch < 0x20 || ch >= ABOVE_UCS_RANGE) {
102103
return -1;
103104
}
104105
}

source/fatdir.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int _FAT_unlink_r (struct _reent *r, const char *path) {
136136
if (!_FAT_directory_isDot (&dirContents)) {
137137
// The directory had something in it that isn't a reference to itself or it's parent
138138
_FAT_unlock(&partition->lock);
139-
r->_errno = EPERM;
139+
r->_errno = ENOTEMPTY;
140140
return -1;
141141
}
142142
nextEntry = _FAT_directory_getNextEntry (partition, &dirContents);
@@ -588,7 +588,6 @@ int _FAT_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filename, struct
588588
// Make sure there is another file to report on
589589
if (! state->validEntry) {
590590
_FAT_unlock(&state->partition->lock);
591-
r->_errno = ENOENT;
592591
return -1;
593592
}
594593

0 commit comments

Comments
 (0)