diff options
author | Werner Koch <wk@gnupg.org> | 2007-08-22 22:36:33 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2007-08-22 22:36:33 +0200 |
commit | 84efbe69c7452fc4fce5f84b5adc4f770aa7613a (patch) | |
tree | f20057c44d67c70925afcee9f0fd9f0ab53e744b /agent/findkey.c | |
parent | Updated estream. (diff) | |
download | gnupg2-84efbe69c7452fc4fce5f84b5adc4f770aa7613a.tar.xz gnupg2-84efbe69c7452fc4fce5f84b5adc4f770aa7613a.zip |
Fixed creation of private keys under W32.
Minor code cleanups.
Diffstat (limited to 'agent/findkey.c')
-rw-r--r-- | agent/findkey.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/agent/findkey.c b/agent/findkey.c index 35254c433..d8dc52696 100644 --- a/agent/findkey.c +++ b/agent/findkey.c @@ -32,6 +32,10 @@ #include "agent.h" +#ifndef O_BINARY +#define O_BINARY 0 +#endif + /* Helper to pass data to the check callback of the unprotect function. */ struct try_unprotect_arg_s { const unsigned char *protected_key; @@ -70,8 +74,8 @@ agent_write_private_key (const unsigned char *grip, POSIX (GNU provides the "x" opentype for fopen, however, this is not portable). Thus, we use the more flexible open function and then use fdopen to obtain a stream. */ - fd = open (fname, force? (O_CREAT | O_TRUNC | O_WRONLY) - : (O_CREAT | O_EXCL | O_WRONLY), + fd = open (fname, force? (O_CREAT | O_TRUNC | O_WRONLY | O_BINARY) + : (O_CREAT | O_EXCL | O_WRONLY | O_BINARY), S_IRUSR | S_IWUSR #ifndef HAVE_W32_SYSTEM | S_IRGRP |