so the check for dry_run and CHECK_RO are not done when flags is O_RDONLY.
Only do the adding of O_BINARY, which was the intention.
int do_open(char *pathname, int flags, mode_t mode)
{
int do_open(char *pathname, int flags, mode_t mode)
{
- if (dry_run) return -1;
+ if (flags != O_RDONLY) {
+ if (dry_run) return -1;
+ CHECK_RO
+ }
#ifdef O_BINARY
/* for Windows */
flags |= O_BINARY;
#endif
#ifdef O_BINARY
/* for Windows */
flags |= O_BINARY;
#endif
return open(pathname, flags, mode);
}
return open(pathname, flags, mode);
}