Fix how the shell appends.
This commit is contained in:
parent
66f1a62743
commit
2492f0bad7
|
@ -331,8 +331,12 @@ readcmd:
|
||||||
if ( outputfile )
|
if ( outputfile )
|
||||||
{
|
{
|
||||||
close(1);
|
close(1);
|
||||||
int flags = O_CREAT | O_WRONLY | O_APPEND;
|
// TODO: Is this logic right or wrong?
|
||||||
if ( strcmp(execmode, ">") == 0 ) { flags |= O_TRUNC; }
|
int flags = O_CREAT | O_WRONLY;
|
||||||
|
if ( strcmp(execmode, ">") == 0 )
|
||||||
|
flags |= O_TRUNC;
|
||||||
|
if ( strcmp(execmode, ">>") == 0 )
|
||||||
|
flags |= O_APPEND;
|
||||||
if ( open(outputfile, flags, 0666) < 0 )
|
if ( open(outputfile, flags, 0666) < 0 )
|
||||||
{
|
{
|
||||||
error(127, errno, "%s", outputfile);
|
error(127, errno, "%s", outputfile);
|
||||||
|
|
Loading…
Reference in New Issue