The open() system call in f8 really broken...

Steve Dickson SteveD at redhat.com
Thu Aug 16 20:39:27 UTC 2007


Pete Zaitcev wrote:
> On Thu, 16 Aug 2007 14:21:17 -0500 (CDT), "Jon Ciesla" <limb at jcomserv.net> wrote:
> 
>>>> - if ((fd = open(fname, readonly? O_RDONLY : (O_RDWR|O_CREAT))) < 0) {
>>>> + if ((fd = (open)(fname, readonly? O_RDONLY : (O_RDWR|O_CREAT))) < 0) {
>>> Now you're just being unfriendly about it by finding ways to defeat
>>> a helpful check instead of adding the missing mode. What point are
>>> you trying to prove by doing this?
>> What would the preferred fix look like?  I'd like to get this sorted out,
>> as I'd like to send a patch for one of my affected packages upstream.
> 
> I would go for this myself, using Steve's example:
> 
> -  if ((fd = open(fname, readonly? O_RDONLY : (O_RDWR|O_CREAT))) < 0) {
> +  if (readonly)
> +    fd = open(fname, O_RDONLY);
> +  else
> +    fd = open(fname, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
> +  if (fd < 0) {
I did this way because I thought it made the code more readable if
I broke things into separate statements... I've never been a fan of
inlining statements...

steved.




More information about the Fedora-maintainers mailing list