Mail Archives: djgpp/2015/05/16/05:26:45
> Date: Sat, 16 May 2015 12:12:14 +0300
> From: "Ozkan Sezer (sezeroz AT gmail DOT com)" <djgpp AT delorie DOT com>
>
> Is the OPENFLAGS really correct in dlopen.c? I mean, is it not
> supposed to be like the opposite, like:
>
> Index: src/libc/dxe/dlopen.c
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libc/dxe/dlopen.c,v
> retrieving revision 1.4
> diff -U 6 -r1.4 dlopen.c
> --- src/libc/dxe/dlopen.c 16 May 2015 05:39:20 -0000 1.4
> +++ src/libc/dxe/dlopen.c 16 May 2015 09:05:40 -0000
> @@ -18,21 +18,21 @@
> #ifdef __DJGPP__
> #include <io.h>
> #define ACCESS(f) (_chmod(f, 0) != -1)
> #define OPEN _open
> #define READ _read
> #define CLOSE _close
> -#define OPENFLAGS O_RDONLY
> +#define OPENFLAGS O_RDONLY | O_BINARY
No, it should be O_RDONLY, because we call '_open', not 'open', which
interprets its 2nd argument as read/write access mode, and always
opens the file in binary mode. If you add O_BINARY, the argument will
be 4, which will be interpreted by _open to mean something about
sharing, which is not what we want.
I do agree that this trick is worth a comment that explains the above.
- Raw text -