summaryrefslogtreecommitdiff
path: root/uisimulator/common
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-02-22 14:41:45 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-02-22 14:41:45 +0000
commit37b15d3833a8663458a541a2ad1e20fc66b233cf (patch)
treed109ef0cb8184a8776419482bc8a91b766b73959 /uisimulator/common
parent289cee80ed3168acef7ed463fe0a77b7351160bb (diff)
downloadrockbox-37b15d3833a8663458a541a2ad1e20fc66b233cf.tar.gz
rockbox-37b15d3833a8663458a541a2ad1e20fc66b233cf.zip
Protect against text-mode files in Windows by using open() instead of creat()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8781 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/common')
-rw-r--r--uisimulator/common/io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index 6e21116add..bf72054b08 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -168,12 +168,12 @@ int sim_open(const char *name, int o)
168int sim_creat(const char *name, mode_t mode) 168int sim_creat(const char *name, mode_t mode)
169{ 169{
170 char buffer[256]; /* sufficiently big */ 170 char buffer[256]; /* sufficiently big */
171 (void)mode; 171 int opts = rockbox2sim(mode);
172 if(name[0] == '/') { 172 if(name[0] == '/') {
173 sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); 173 sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
174 174
175 debugf("We create the real file '%s'\n", buffer); 175 debugf("We create the real file '%s'\n", buffer);
176 return creat(buffer, 0666); 176 return open(buffer, opts | O_CREAT | O_TRUNC, 0666);
177 } 177 }
178 fprintf(stderr, "WARNING, bad file name lacks slash: %s\n", 178 fprintf(stderr, "WARNING, bad file name lacks slash: %s\n",
179 name); 179 name);