On 10/10/2015 19:30, Kern Sibbald wrote: > On 10/10/2015 10:16 AM, Phil Stracchino wrote: >> On 10/09/15 22:05, Kern Sibbald wrote: >>> Hello, >>> >>> Thanks for pointing this out. I still have problems imagining that they >>> would define O_RDONLY as 0 in a bitmapped variable!!! >> It makes more sense if you think of it as the absence of O_RDWR. > > Unfortunately, it is even more complicated than that, because it is > actually the absence of O_RWRD and O_WRONLY. > > In my opinion the original implementation was faulty because O_RDONLY > should really be defined as: > > #define O_RDONLY !(O_RWRD&O_RONLY) > > See my second to last commit ... > > Goan, but that is how it is so now we know, and hopefully it should now > work correctly. > > Best regards, > Kern
Aren't people over-complicating this? You need to think of this as a 2-bit integer field, not as a bitmap. Then looking at the constants defined in fcntl.h, it becomes clear (to me, anyway!) that the code should be (sorry, I forget the exact context, but you'll see what I mean, I hope) (flags & O_ACCMODE) == O_RDONLY (The Solaris box I am looking at defines #define O_ACCMODE 3 /* Mask for file access modes */ while a nearby Linux system has #define O_ACCMODE 00000003 #define O_RDONLY 00000000 #define O_WRONLY 00000001 #define O_RDWR 00000002 ) Regards, Richard ------------------------------------------------------------------------------ _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users