From 37b15d3833a8663458a541a2ad1e20fc66b233cf Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 22 Feb 2006 14:41:45 +0000 Subject: 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 --- uisimulator/common/io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'uisimulator') 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) int sim_creat(const char *name, mode_t mode) { char buffer[256]; /* sufficiently big */ - (void)mode; + int opts = rockbox2sim(mode); if(name[0] == '/') { sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); debugf("We create the real file '%s'\n", buffer); - return creat(buffer, 0666); + return open(buffer, opts | O_CREAT | O_TRUNC, 0666); } fprintf(stderr, "WARNING, bad file name lacks slash: %s\n", name); -- cgit