+Tue Dec 17 10:05:00 CET 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Fixed file writing on WIN32 to use O_BINARY flag. Affected
+ file is lib/silcutil/silcfileutil.c. A patch by Matthew
+ Aldous <Matthew@Aldous.com>.
+
Mon Dec 16 19:33:05 EET 2002 Pekka Riikonen <priikone@silcnet.org>
* Fixed double free in async host lookup code. Affected file
SilcUInt32 len)
{
int fd;
+ int flags = O_CREAT | O_WRONLY | O_TRUNC;
- if ((fd = creat(filename, 0644)) == -1) {
+#if defined(O_BINARY)
+ flags |= O_BINARY;
+#endif /* O_BINARY */
+
+ if ((fd = open(filename, flags, 0644))
+ == -1) {
SILC_LOG_ERROR(("Cannot open file %s for writing: %s", filename,
strerror(errno)));
return -1;
SilcUInt32 len, int mode)
{
int fd;
+ int flags = O_CREAT | O_WRONLY | O_TRUNC;
+
+#if defined(O_BINARY)
+ flags |= O_BINARY;
+#endif /* O_BINARY */
- if ((fd = creat(filename, mode)) == -1) {
+ if ((fd = open(filename, flags, 0644))
+ == -1) {
SILC_LOG_ERROR(("Cannot open file %s for writing: %s", filename,
strerror(errno)));
return -1;