[U-Boot] [PATCHv3 5/8] mkenvimage: Read/Write from/to stdin/out by default or if the filename is "-"

David Wagner david.wagner at free-electrons.com
Sun Jan 8 13:02:40 CET 2012


Le 08/01/2012 07:50, Mike Frysinger a écrit :
> On Thursday 05 January 2012 13:44:56 David Wagner wrote:
>> +		bin_fd = creat(bin_filename, S_IRUSR | S_IWUSR | S_IRGRP |
>> +					     S_IWGRP);
>
> this should prob be open()
> -mike

What is wrong with creat() ?
from 'man 2 creat': creat() is equivalent to open() with flags equal to 
O_CREAT|O_WRONLY|O_TRUNC.
We want to create the file if it doesn't exist and truncate it if it does.

The only issue I can think of is that no additional flag can be passed 
to creat(); fcntl can alter some of them.  But will we need any ?

Regards,
David.


More information about the U-Boot mailing list