2007-08-22 Marcus Brinkmann <marcus@g10code.de>
* w32-io.c (_gpgme_io_write): Return early if COUNT is zero. (writer): Remove superfluous check.
This commit is contained in:
parent
597e0283e2
commit
c9dc982ce3
@ -1,3 +1,8 @@
|
|||||||
|
2007-08-22 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* w32-io.c (_gpgme_io_write): Return early if COUNT is zero.
|
||||||
|
(writer): Remove superfluous check.
|
||||||
|
|
||||||
2007-08-20 Marcus Brinkmann <marcus@g10code.de>
|
2007-08-20 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* gpgme.h: Move include of gpg-error.h out of extern "C".
|
* gpgme.h: Move include of gpg-error.h out of extern "C".
|
||||||
|
@ -531,20 +531,22 @@ writer (void *arg)
|
|||||||
UNLOCK (ctx->mutex);
|
UNLOCK (ctx->mutex);
|
||||||
|
|
||||||
TRACE_LOG1 ("writing %d bytes", ctx->nbytes);
|
TRACE_LOG1 ("writing %d bytes", ctx->nbytes);
|
||||||
if (ctx->nbytes
|
/* Note that CTX->nbytes is not zero at this point, because
|
||||||
&& !WriteFile (ctx->file_hd, ctx->buffer,
|
_gpgme_io_write always writes at least 1 byte before waking
|
||||||
ctx->nbytes, &nwritten, NULL))
|
us up, unless CTX->stop_me is true, which we catch above. */
|
||||||
{
|
if (!WriteFile (ctx->file_hd, ctx->buffer,
|
||||||
ctx->error_code = (int) GetLastError ();
|
ctx->nbytes, &nwritten, NULL))
|
||||||
ctx->error = 1;
|
{
|
||||||
TRACE_LOG1 ("write error: ec=%d", ctx->error_code);
|
ctx->error_code = (int) GetLastError ();
|
||||||
break;
|
ctx->error = 1;
|
||||||
}
|
TRACE_LOG1 ("write error: ec=%d", ctx->error_code);
|
||||||
TRACE_LOG1 ("wrote %d bytes", (int) nwritten);
|
break;
|
||||||
|
}
|
||||||
|
TRACE_LOG1 ("wrote %d bytes", (int) nwritten);
|
||||||
|
|
||||||
LOCK (ctx->mutex);
|
LOCK (ctx->mutex);
|
||||||
ctx->nbytes -= nwritten;
|
ctx->nbytes -= nwritten;
|
||||||
UNLOCK (ctx->mutex);
|
UNLOCK (ctx->mutex);
|
||||||
}
|
}
|
||||||
/* Indicate that we have an error. */
|
/* Indicate that we have an error. */
|
||||||
if (!SetEvent (ctx->is_empty))
|
if (!SetEvent (ctx->is_empty))
|
||||||
@ -724,6 +726,9 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
|
|||||||
"buffer=%p, count=%u", buffer, count);
|
"buffer=%p, count=%u", buffer, count);
|
||||||
TRACE_LOGBUF (buffer, count);
|
TRACE_LOGBUF (buffer, count);
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
return TRACE_SYS (0);
|
||||||
|
|
||||||
ctx = find_writer (fd, 1);
|
ctx = find_writer (fd, 1);
|
||||||
if (!ctx)
|
if (!ctx)
|
||||||
return TRACE_SYSRES (-1);
|
return TRACE_SYSRES (-1);
|
||||||
|
Loading…
Reference in New Issue
Block a user