aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2011-02-02 12:47:53 +0000
committerMarcus Brinkmann <[email protected]>2011-02-02 12:47:53 +0000
commita2b9adafe46c55a2c26dd46163055bbdf3526835 (patch)
treef4b947a8b3f596b17fbc18ec14a7367e29fe19d1
parentMight now build for CE using MSC. (diff)
downloadgpgme-a2b9adafe46c55a2c26dd46163055bbdf3526835.tar.gz
gpgme-a2b9adafe46c55a2c26dd46163055bbdf3526835.zip
2011-02-02 Marcus Brinkmann <[email protected]>
* w32-util.c (mkstemp): Don't use CreateFile instead of open (the function is not used on Windows CE, and the callers were not adjusted).
-rw-r--r--src/ChangeLog6
-rw-r--r--src/w32-util.c30
2 files changed, 21 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 562d2977..fe850956 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-02 Marcus Brinkmann <[email protected]>
+
+ * w32-util.c (mkstemp): Don't use CreateFile instead of open (the
+ function is not used on Windows CE, and the callers were not
+ adjusted).
+
2010-11-02 Werner Koch <[email protected]>
* data-fd.c (read, write, lseek) [W32CE && ! __MINGW32CE__]: New.
diff --git a/src/w32-util.c b/src/w32-util.c
index ec2fe50f..c29ff490 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -473,6 +473,14 @@ _gpgme_get_conf_int (const char *key, int *value)
}
+#ifdef HAVE_W32CE_SYSTEM
+int
+_gpgme_mkstemp (int *fd, char **name)
+{
+ return -1;
+}
+#else
+
/* mkstemp extracted from libc/sysdeps/posix/tempname.c. Copyright
(C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc.
@@ -496,7 +504,7 @@ mkstemp (char *tmpl)
static uint64_t value;
uint64_t random_time_bits;
unsigned int count;
- HANDLE fd = INVALID_HANDLE_VALUE;
+ int fd = -1;
int save_errno = errno;
/* A lower bound on the number of temporary files to attempt to
@@ -552,23 +560,14 @@ mkstemp (char *tmpl)
v /= 62;
XXXXXX[5] = letters[v % 62];
- fd = CreateFileA (tmpl,
- GENERIC_WRITE|GENERIC_READ,
- FILE_SHARE_READ|FILE_SHARE_WRITE,
- NULL,
- CREATE_NEW,
- FILE_ATTRIBUTE_NORMAL,
- NULL);
- if (fd != INVALID_HANDLE_VALUE)
+ fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+ if (fd >= 0)
{
gpg_err_set_errno (save_errno);
- return (int)fd;
+ return fd;
}
- else if (GetLastError () != ERROR_FILE_EXISTS)
- {
- gpg_err_set_errno (EIO);
- return -1;
- }
+ else if (errno != EEXIST)
+ return -1;
}
/* We got out of the loop because we ran out of combinations to try. */
@@ -613,6 +612,7 @@ _gpgme_mkstemp (int *fd, char **name)
*name = tmpname;
return 0;
}
+#endif