[PATCH, libiberty] mkstemps and binary mode
DJ Delorie
dj@redhat.com
Wed May 10 21:21:00 GMT 2006
> OK, so how about this:
That's fine. Thanks!
> Index: mkstemps.c
> ===================================================================
> --- mkstemps.c (revision 113631)
> +++ mkstemps.c (working copy)
> @@ -49,6 +49,10 @@ typedef unsigned long gcc_uint64_t;
> #define TMP_MAX 16384
> #endif
>
> +#ifndef O_BINARY
> +# define O_BINARY 0
> +#endif
> +
> /*
>
> @deftypefn Replacement int mkstemps (char *@var{pattern}, int @var{suffix_len})
> @@ -119,7 +123,7 @@ mkstemps (char *pattern, int suffix_len)
> v /= 62;
> XXXXXX[5] = letters[v % 62];
>
> - fd = open (pattern, O_RDWR|O_CREAT|O_EXCL, 0600);
> + fd = open (pattern, O_BINARY|O_RDWR|O_CREAT|O_EXCL, 0600);
> if (fd >= 0)
> /* The file does not exist. */
> return fd;
>
More information about the Gcc-patches
mailing list