forked from len0rd/rockbox
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
This commit is contained in:
parent
289cee80ed
commit
37b15d3833
1 changed files with 2 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue