mescc: Support binutils-2.10.1: opentype `r+'.
* lib/libc+tcc.c (fopen): Support opentype `r+'.
This commit is contained in:
parent
831bd71a14
commit
3ba5b23dab
|
@ -189,12 +189,14 @@ fopen (char const *file_name, char const *opentype)
|
|||
{
|
||||
int fd;
|
||||
int mode = 0600;
|
||||
if (opentype[0] == 'a' && !access (file_name, O_RDONLY))
|
||||
if ((opentype[0] == 'a' || !strcmp (opentype, "r+"))
|
||||
&& !access (file_name, O_RDONLY))
|
||||
{
|
||||
fd = open (file_name, O_RDWR, mode);
|
||||
lseek (fd, 0, SEEK_END);
|
||||
if (opentype[0] == 'a')
|
||||
lseek (fd, 0, SEEK_END);
|
||||
}
|
||||
else if (opentype[0] == 'w' || opentype[0] == 'a')
|
||||
else if (opentype[0] == 'w' || opentype[0] == 'a' || !strcmp (opentype, "r+"))
|
||||
{
|
||||
char *plus_p = strchr (opentype, '+');
|
||||
int flags = plus_p ? O_RDWR | O_CREAT : O_WRONLY | O_CREAT | O_TRUNC;
|
||||
|
|
Loading…
Reference in a new issue