summaryrefslogtreecommitdiff
path: root/firmware/common
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/common')
-rw-r--r--firmware/common/file.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index 4477ed10aa..dfbebe1b90 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -40,6 +40,7 @@ struct filedesc {
40 int cacheoffset; 40 int cacheoffset;
41 int fileoffset; 41 int fileoffset;
42 int size; 42 int size;
43 int attr;
43 struct fat_file fatfile; 44 struct fat_file fatfile;
44 bool busy; 45 bool busy;
45 bool write; 46 bool write;
@@ -122,6 +123,7 @@ int open(const char* pathname, int flags)
122 &(file->fatfile), 123 &(file->fatfile),
123 &(dir->fatdir)); 124 &(dir->fatdir));
124 file->size = entry->size; 125 file->size = entry->size;
126 file->attr = entry->attribute;
125 break; 127 break;
126 } 128 }
127 } 129 }
@@ -139,6 +141,7 @@ int open(const char* pathname, int flags)
139 return -5; 141 return -5;
140 } 142 }
141 file->size = 0; 143 file->size = 0;
144 file->attr = 0;
142 } 145 }
143 else { 146 else {
144 DEBUGF("Couldn't find %s in %s\n",name,pathname); 147 DEBUGF("Couldn't find %s in %s\n",name,pathname);
@@ -190,7 +193,7 @@ int close(int fd)
190 } 193 }
191 194
192 /* tie up all loose ends */ 195 /* tie up all loose ends */
193 if (fat_closewrite(&(file->fatfile), file->size) < 0) 196 if (fat_closewrite(&(file->fatfile), file->size, file->attr) < 0)
194 return -3; 197 return -3;
195 } 198 }
196 file->busy = false; 199 file->busy = false;
@@ -257,7 +260,7 @@ int rename(const char* path, const char* newpath)
257 nameptr = (char*)newpath; 260 nameptr = (char*)newpath;
258 261
259 file = &openfiles[fd]; 262 file = &openfiles[fd];
260 rc = fat_rename(&file->fatfile, nameptr, file->size); 263 rc = fat_rename(&file->fatfile, nameptr, file->size, file->attr);
261 if ( rc < 0 ) { 264 if ( rc < 0 ) {
262 DEBUGF("Failed renaming file: %d\n", rc); 265 DEBUGF("Failed renaming file: %d\n", rc);
263 errno = EIO; 266 errno = EIO;