mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
2004-11-03 Timo Schulz <twoaday@g10code.com>
* strgutil.c (w32_strerror): New. * ttyio.c (init_ttyfp, tty_printf, do_get): Use it here. * iobuf.c (fd_cache_open, file_filter): Likewise. (iobuf_seek, translate_file_handle): Likewise.
This commit is contained in:
parent
b467558d9e
commit
37ecd725e5
2
THANKS
2
THANKS
@ -196,7 +196,7 @@ Thiago Jung Bauermann jungmann@cwb.matrix.com.br
|
|||||||
Thijmen Klok thijmen@xs4all.nl
|
Thijmen Klok thijmen@xs4all.nl
|
||||||
Thomas Roessler roessler@guug.de
|
Thomas Roessler roessler@guug.de
|
||||||
Tim Mooney mooney@dogbert.cc.ndsu.nodak.edu
|
Tim Mooney mooney@dogbert.cc.ndsu.nodak.edu
|
||||||
Timo Schulz towaday@freakmail.de
|
Timo Schulz twoaday@freakmail.de
|
||||||
Todd Vierling tv@pobox.com
|
Todd Vierling tv@pobox.com
|
||||||
TOGAWA Satoshi Satoshi.Togawa@jp.yokogawa.com
|
TOGAWA Satoshi Satoshi.Togawa@jp.yokogawa.com
|
||||||
Tom Spindler dogcow@home.merit.edu
|
Tom Spindler dogcow@home.merit.edu
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2004-11-03 Timo Schulz <twoaday@g10code.com>
|
||||||
|
|
||||||
|
* idea-stub.c (dlopen, dlsym): Use w32_strerror instead of
|
||||||
|
just showing the error number.
|
||||||
|
|
||||||
2004-10-14 Werner Koch <wk@g10code.com>
|
2004-10-14 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* rndunix.c (start_gatherer) [ENABLE_SELINUX_HACKS]: Don't allow
|
* rndunix.c (start_gatherer) [ENABLE_SELINUX_HACKS]: Don't allow
|
||||||
|
@ -63,7 +63,7 @@ dlopen (const char *pathname, int mode)
|
|||||||
void *h = LoadLibrary (pathname);
|
void *h = LoadLibrary (pathname);
|
||||||
if (!h)
|
if (!h)
|
||||||
{
|
{
|
||||||
log_error ("LoadLibrary failed ec=%d\n", (int)GetLastError());
|
log_error ("LoadLibrary failed: %s\n", w32_strerror (errno));
|
||||||
last_error = 1;
|
last_error = 1;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -77,25 +77,22 @@ dlclose ( void *handle )
|
|||||||
return FreeLibrary (handle);
|
return FreeLibrary (handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
|
||||||
|
const char*
|
||||||
dlerror (void)
|
dlerror (void)
|
||||||
{
|
{
|
||||||
static char dlerrstr[10];
|
|
||||||
if (last_error)
|
if (last_error)
|
||||||
{
|
return w32_strerror (0);
|
||||||
sprintf(dlerrstr, "%d", (int)GetLastError() );
|
|
||||||
return dlerrstr;
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
void*
|
||||||
dlsym ( void *handle, const char *name )
|
dlsym (void *handle, const char *name)
|
||||||
{
|
{
|
||||||
void *h = GetProcAddress (handle, name);
|
void *h = GetProcAddress (handle, name);
|
||||||
if (!h)
|
if (!h)
|
||||||
{
|
{
|
||||||
log_error ("GetProcAddress failed ec=%d\n", (int)GetLastError());
|
log_error ("GetProcAddress failed: %s\n", w32_strerror (errno));
|
||||||
last_error = 1;
|
last_error = 1;
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2004-11-03 Timo Schulz <twoaday@g10code.com>
|
||||||
|
|
||||||
|
* passphrase.c (readn, writen): Use w32_strerror instead
|
||||||
|
of just showing the error number.
|
||||||
|
* misc.c [_WIN32]: Fix warning about missing prototypes.
|
||||||
|
|
||||||
2004-10-28 David Shaw <dshaw@jabberwocky.com>
|
2004-10-28 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* skclist.c (build_sk_list): Don't need to warn about
|
* skclist.c (build_sk_list): Don't need to warn about
|
||||||
|
@ -37,6 +37,10 @@
|
|||||||
#ifdef ENABLE_SELINUX_HACKS
|
#ifdef ENABLE_SELINUX_HACKS
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <time.h>
|
||||||
|
#include <process.h>
|
||||||
|
#endif
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "photoid.h"
|
#include "photoid.h"
|
||||||
|
133
g10/passphrase.c
133
g10/passphrase.c
@ -189,99 +189,108 @@ read_passphrase_from_fd( int fd )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
writen ( int fd, const void *buf, size_t nbytes )
|
writen (int fd, const void *buf, size_t nbytes)
|
||||||
{
|
{
|
||||||
#if defined (_WIN32)
|
#if defined (_WIN32)
|
||||||
DWORD nwritten, nleft = nbytes;
|
DWORD nwritten, nleft = nbytes;
|
||||||
|
|
||||||
while (nleft > 0) {
|
while (nleft > 0)
|
||||||
if ( !WriteFile( (HANDLE)write_fd, buf, nleft, &nwritten, NULL) ) {
|
{
|
||||||
log_error("write failed: ec=%d\n", (int)GetLastError());
|
if (!WriteFile ((HANDLE)write_fd, buf, nleft, &nwritten, NULL))
|
||||||
return -1;
|
{
|
||||||
}
|
log_error ("write failed: %s\n", w32_strerror (0));
|
||||||
/*log_info("** WriteFile fd=%d nytes=%d nwritten=%d\n",
|
return -1;
|
||||||
write_fd, nbytes, (int)nwritten);*/
|
}
|
||||||
Sleep(100);
|
/*log_info ("** WriteFile fd=%d nytes=%d nwritten=%d\n",
|
||||||
|
write_fd, nbytes, (int)nwritten);*/
|
||||||
|
Sleep (100);
|
||||||
|
|
||||||
nleft -= nwritten;
|
nleft -= nwritten;
|
||||||
buf = (const BYTE *)buf + nwritten;
|
buf = (const BYTE *)buf + nwritten;
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
#elif defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
||||||
/* not implemented */
|
/* not implemented */
|
||||||
#else
|
#else
|
||||||
size_t nleft = nbytes;
|
size_t nleft = nbytes;
|
||||||
int nwritten;
|
int nwritten;
|
||||||
|
|
||||||
while( nleft > 0 ) {
|
while (nleft > 0)
|
||||||
nwritten = write( fd, buf, nleft );
|
{
|
||||||
if( nwritten < 0 ) {
|
nwritten = write (fd, buf, nleft);
|
||||||
if ( errno == EINTR )
|
if (nwritten < 0)
|
||||||
nwritten = 0;
|
{
|
||||||
else {
|
if (errno == EINTR)
|
||||||
log_error ( "write() failed: %s\n", strerror (errno) );
|
nwritten = 0;
|
||||||
return -1;
|
else
|
||||||
|
{
|
||||||
|
log_error ("write() failed: %s\n", strerror (errno));
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nleft -= nwritten;
|
nleft -= nwritten;
|
||||||
buf = (const char*)buf + nwritten;
|
buf = (const char*)buf + nwritten;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
readn ( int fd, void *buf, size_t buflen, size_t *ret_nread )
|
readn (int fd, void *buf, size_t buflen, size_t *ret_nread)
|
||||||
{
|
{
|
||||||
#if defined (_WIN32)
|
#if defined (_WIN32)
|
||||||
DWORD nread, nleft = buflen;
|
DWORD nread, nleft = buflen;
|
||||||
|
|
||||||
while (nleft > 0) {
|
while (nleft > 0)
|
||||||
if ( !ReadFile( (HANDLE)read_fd, buf, nleft, &nread, NULL) ) {
|
{
|
||||||
log_error("read() error: ec=%d\n", (int)GetLastError());
|
if (!ReadFile ((HANDLE)read_fd, buf, nleft, &nread, NULL))
|
||||||
return -1;
|
{
|
||||||
|
log_error ("read() error: %s\n", w32_strerror (0));
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
if (!nread || GetLastError() == ERROR_BROKEN_PIPE)
|
if (!nread || GetLastError() == ERROR_BROKEN_PIPE)
|
||||||
break;
|
break;
|
||||||
/*log_info("** ReadFile fd=%d buflen=%d nread=%d\n",
|
/*log_info ("** ReadFile fd=%d buflen=%d nread=%d\n",
|
||||||
read_fd, buflen, (int)nread);*/
|
read_fd, buflen, (int)nread);*/
|
||||||
Sleep(100);
|
Sleep (100);
|
||||||
|
|
||||||
nleft -= nread;
|
nleft -= nread;
|
||||||
buf = (BYTE *)buf + nread;
|
buf = (BYTE *)buf + nread;
|
||||||
}
|
}
|
||||||
if (ret_nread)
|
if (ret_nread)
|
||||||
*ret_nread = buflen - nleft;
|
*ret_nread = buflen - nleft;
|
||||||
|
|
||||||
#elif defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
#elif defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__)
|
||||||
/* not implemented */
|
/* not implemented */
|
||||||
#else
|
#else
|
||||||
size_t nleft = buflen;
|
size_t nleft = buflen;
|
||||||
int nread;
|
int nread;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
p = buf;
|
p = buf;
|
||||||
while( nleft > 0 ) {
|
while (nleft > 0)
|
||||||
nread = read ( fd, buf, nleft );
|
{
|
||||||
if( nread < 0 ) {
|
nread = read (fd, buf, nleft);
|
||||||
if (nread == EINTR)
|
if (nread < 0)
|
||||||
nread = 0;
|
{
|
||||||
else {
|
if (nread == EINTR)
|
||||||
log_error ( "read() error: %s\n", strerror (errno) );
|
nread = 0;
|
||||||
return -1;
|
else {
|
||||||
}
|
log_error ("read() error: %s\n", strerror (errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( !nread )
|
else if (!nread)
|
||||||
break; /* EOF */
|
break; /* EOF */
|
||||||
nleft -= nread;
|
nleft -= nread;
|
||||||
buf = (char*)buf + nread;
|
buf = (char*)buf + nread;
|
||||||
}
|
}
|
||||||
if( ret_nread )
|
if (ret_nread)
|
||||||
*ret_nread = buflen - nleft;
|
*ret_nread = buflen - nleft;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read an entire line */
|
/* read an entire line */
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2004-11-03 Timo Schulz <twoaday@g10code.com>
|
||||||
|
|
||||||
|
* errors.h: Add w32_strerror prototype.
|
||||||
|
* dynload.h: Use w32_strerror.
|
||||||
|
|
||||||
2004-10-27 Werner Koch <wk@g10code.com>
|
2004-10-27 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* dynload.h: Always use it for _WIN32.
|
* dynload.h: Always use it for _WIN32.
|
||||||
|
@ -52,9 +52,7 @@ dlsym (void * hd, const char * sym)
|
|||||||
static __inline__ const char *
|
static __inline__ const char *
|
||||||
dlerror (void)
|
dlerror (void)
|
||||||
{
|
{
|
||||||
static char buf[32];
|
return w32_strerror (0);
|
||||||
sprintf (buf, "ec=%lu\n", GetLastError ());
|
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +79,11 @@
|
|||||||
#define G10ERR_NO_CARD 57
|
#define G10ERR_NO_CARD 57
|
||||||
|
|
||||||
#ifndef HAVE_STRERROR
|
#ifndef HAVE_STRERROR
|
||||||
char *strerror( int n );
|
char *strerror (int n);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
const char * w32_strerror (int w32_errno);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*G10_ERRORS_H*/
|
#endif /*G10_ERRORS_H*/
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2004-11-03 Timo Schulz <twoaday@g10code.com>
|
||||||
|
|
||||||
|
* strgutil.c (w32_strerror): New.
|
||||||
|
* ttyio.c (init_ttyfp, tty_printf, do_get): Use it here.
|
||||||
|
* iobuf.c (fd_cache_open, file_filter): Likewise.
|
||||||
|
(iobuf_seek, translate_file_handle): Likewise.
|
||||||
|
|
||||||
2004-11-02 Werner Koch <wk@g10code.com>
|
2004-11-02 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* strgutil.c (load_libiconv): Use log_info to avoid failures when
|
* strgutil.c (load_libiconv): Use log_info to avoid failures when
|
||||||
|
30
util/iobuf.c
30
util/iobuf.c
@ -287,8 +287,8 @@ fd_cache_open (const char *fname, const char *mode)
|
|||||||
log_debug ("fd_cache_open (%s) using cached fp\n", fname);
|
log_debug ("fd_cache_open (%s) using cached fp\n", fname);
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
if (SetFilePointer (fp, 0, NULL, FILE_BEGIN) == 0xffffffff ) {
|
if (SetFilePointer (fp, 0, NULL, FILE_BEGIN) == 0xffffffff ) {
|
||||||
log_error ("rewind file failed on handle %p: ec=%d\n",
|
log_error ("rewind file failed on handle %p: %s\n",
|
||||||
fp, (int)GetLastError () );
|
fp, w32_strerror (errno));
|
||||||
fp = INVALID_FP;
|
fp = INVALID_FP;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -404,9 +404,9 @@ file_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
|
|||||||
|
|
||||||
nbytes = 0;
|
nbytes = 0;
|
||||||
if ( !ReadFile ( f, buf, size, &nread, NULL ) ) {
|
if ( !ReadFile ( f, buf, size, &nread, NULL ) ) {
|
||||||
int ec = (int)GetLastError ();
|
if ((int)GetLastError () != ERROR_BROKEN_PIPE) {
|
||||||
if ( ec != ERROR_BROKEN_PIPE ) {
|
log_error ("%s: read error: %s\n", a->fname,
|
||||||
log_error("%s: read error: ec=%d\n", a->fname, ec);
|
w32_strerror (0));
|
||||||
rc = G10ERR_READ_FILE;
|
rc = G10ERR_READ_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -452,9 +452,9 @@ file_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
|
|||||||
|
|
||||||
nbytes = size;
|
nbytes = size;
|
||||||
do {
|
do {
|
||||||
if ( size && !WriteFile ( f, p, nbytes, &n, NULL) ) {
|
if (size && !WriteFile (f, p, nbytes, &n, NULL)) {
|
||||||
int ec = (int)GetLastError ();
|
log_error ("%s: write error: %s\n", a->fname,
|
||||||
log_error("%s: write error: ec=%d\n", a->fname, ec);
|
w32_strerror (0));
|
||||||
rc = G10ERR_WRITE_FILE;
|
rc = G10ERR_WRITE_FILE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1835,10 +1835,10 @@ iobuf_get_filelength( IOBUF a )
|
|||||||
#if defined(HAVE_DOSISH_SYSTEM) && !defined(FILE_FILTER_USES_STDIO)
|
#if defined(HAVE_DOSISH_SYSTEM) && !defined(FILE_FILTER_USES_STDIO)
|
||||||
ulong size;
|
ulong size;
|
||||||
|
|
||||||
if ( (size=GetFileSize (fp, NULL)) != 0xffffffff )
|
if ((size=GetFileSize (fp, NULL)) != 0xffffffff)
|
||||||
return size;
|
return size;
|
||||||
log_error ("GetFileSize for handle %p failed: ec=%d\n",
|
log_error ("GetFileSize for handle %p failed: %s\n",
|
||||||
fp, (int)GetLastError () );
|
fp, w32_strerror (0));
|
||||||
#else
|
#else
|
||||||
if( !fstat(my_fileno(fp), &st) )
|
if( !fstat(my_fileno(fp), &st) )
|
||||||
return st.st_size;
|
return st.st_size;
|
||||||
@ -1945,8 +1945,8 @@ iobuf_seek( IOBUF a, off_t newpos )
|
|||||||
#else
|
#else
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
if (SetFilePointer (b->fp, newpos, NULL, FILE_BEGIN) == 0xffffffff ) {
|
if (SetFilePointer (b->fp, newpos, NULL, FILE_BEGIN) == 0xffffffff ) {
|
||||||
log_error ("SetFilePointer failed on handle %p: ec=%d\n",
|
log_error ("SetFilePointer failed on handle %p: %s\n",
|
||||||
b->fp, (int)GetLastError () );
|
b->fp, w32_strerror (0));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -2143,8 +2143,8 @@ translate_file_handle ( int fd, int for_write )
|
|||||||
x = fd;
|
x = fd;
|
||||||
|
|
||||||
if (x == -1)
|
if (x == -1)
|
||||||
log_debug ("GetStdHandle(%d) failed: ec=%d\n",
|
log_debug ("GetStdHandle(%d) failed: %s\n",
|
||||||
fd, (int)GetLastError () );
|
fd, w32_strerror (0));
|
||||||
|
|
||||||
fd = x;
|
fd = x;
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ gettext( const char *msgid )
|
|||||||
log_info("InputCP=%u OutputCP=%u\n", cp1, cp2 );
|
log_info("InputCP=%u OutputCP=%u\n", cp1, cp2 );
|
||||||
|
|
||||||
if( !SetConsoleOutputCP( 1252 ) )
|
if( !SetConsoleOutputCP( 1252 ) )
|
||||||
log_info("SetConsoleOutputCP failed: %d\n", (int)GetLastError() );
|
log_info("SetConsoleOutputCP failed: %s\n", w32_strerror (0));
|
||||||
|
|
||||||
cp1 = GetConsoleCP();
|
cp1 = GetConsoleCP();
|
||||||
cp2 = GetConsoleOutputCP();
|
cp2 = GetConsoleOutputCP();
|
||||||
|
@ -1260,4 +1260,20 @@ asprintf (char **buf, const char *fmt, ...)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
w32_strerror (int w32_errno)
|
||||||
|
{
|
||||||
|
static char strerr[256];
|
||||||
|
int ec = (int)GetLastError ();
|
||||||
|
|
||||||
|
if (w32_errno == 0)
|
||||||
|
w32_errno = ec;
|
||||||
|
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, w32_errno,
|
||||||
|
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
strerr, DIM (strerr)-1, NULL);
|
||||||
|
return strerr;
|
||||||
|
}
|
||||||
#endif /*_WIN32*/
|
#endif /*_WIN32*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
24
util/ttyio.c
24
util/ttyio.c
@ -140,15 +140,15 @@ init_ttyfp(void)
|
|||||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||||
&sa, OPEN_EXISTING, 0, 0 );
|
&sa, OPEN_EXISTING, 0, 0 );
|
||||||
if( con.out == INVALID_HANDLE_VALUE )
|
if( con.out == INVALID_HANDLE_VALUE )
|
||||||
log_fatal("open(CONOUT$) failed: rc=%d", (int)GetLastError() );
|
log_fatal ("open(CONOUT$) failed: %s", w32_strerror (0));
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
sa.nLength = sizeof(sa);
|
sa.nLength = sizeof(sa);
|
||||||
sa.bInheritHandle = TRUE;
|
sa.bInheritHandle = TRUE;
|
||||||
con.in = CreateFileA( "CONIN$", GENERIC_READ|GENERIC_WRITE,
|
con.in = CreateFileA( "CONIN$", GENERIC_READ|GENERIC_WRITE,
|
||||||
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||||
&sa, OPEN_EXISTING, 0, 0 );
|
&sa, OPEN_EXISTING, 0, 0 );
|
||||||
if( con.in == INVALID_HANDLE_VALUE )
|
if (con.in == INVALID_HANDLE_VALUE)
|
||||||
log_fatal("open(CONIN$) failed: rc=%d", (int)GetLastError() );
|
log_fatal ("open(CONIN$) failed: %s", w32_strerror (0));
|
||||||
}
|
}
|
||||||
SetConsoleMode(con.in, DEF_INPMODE );
|
SetConsoleMode(con.in, DEF_INPMODE );
|
||||||
SetConsoleMode(con.out, DEF_OUTMODE );
|
SetConsoleMode(con.out, DEF_OUTMODE );
|
||||||
@ -212,10 +212,10 @@ tty_printf( const char *fmt, ... )
|
|||||||
if( !buf )
|
if( !buf )
|
||||||
log_bug("vasprintf() failed\n");
|
log_bug("vasprintf() failed\n");
|
||||||
|
|
||||||
if( !WriteConsoleA( con.out, buf, n, &nwritten, NULL ) )
|
if (!WriteConsoleA (con.out, buf, n, &nwritten, NULL))
|
||||||
log_fatal("WriteConsole failed: rc=%d", (int)GetLastError() );
|
log_fatal ("WriteConsole failed: %s", w32_strerror (0));
|
||||||
if( n != nwritten )
|
if( n != nwritten )
|
||||||
log_fatal("WriteConsole failed: %d != %d\n", n, (int)nwritten );
|
log_fatal ("WriteConsole failed: %d != %d\n", n, (int)nwritten );
|
||||||
last_prompt_len += n;
|
last_prompt_len += n;
|
||||||
m_free (buf);
|
m_free (buf);
|
||||||
}
|
}
|
||||||
@ -259,10 +259,10 @@ tty_fprintf (FILE *fp, const char *fmt, ... )
|
|||||||
if( !buf )
|
if( !buf )
|
||||||
log_bug("vasprintf() failed\n");
|
log_bug("vasprintf() failed\n");
|
||||||
|
|
||||||
if( !WriteConsoleA( con.out, buf, n, &nwritten, NULL ) )
|
if (!WriteConsoleA (con.out, buf, n, &nwritten, NULL))
|
||||||
log_fatal("WriteConsole failed: rc=%d", (int)GetLastError() );
|
log_fatal ("WriteConsole failed: %s", w32_strerror (0));
|
||||||
if( n != nwritten )
|
if (n != nwritten)
|
||||||
log_fatal("WriteConsole failed: %d != %d\n", n, (int)nwritten );
|
log_fatal ("WriteConsole failed: %d != %d\n", n, (int)nwritten);
|
||||||
last_prompt_len += n;
|
last_prompt_len += n;
|
||||||
xfree (buf);
|
xfree (buf);
|
||||||
}
|
}
|
||||||
@ -387,8 +387,8 @@ do_get( const char *prompt, int hidden )
|
|||||||
for(;;) {
|
for(;;) {
|
||||||
DWORD nread;
|
DWORD nread;
|
||||||
|
|
||||||
if( !ReadConsoleA( con.in, cbuf, 1, &nread, NULL ) )
|
if (!ReadConsoleA (con.in, cbuf, 1, &nread, NULL))
|
||||||
log_fatal("ReadConsole failed: rc=%d", (int)GetLastError() );
|
log_fatal ("ReadConsole failed: %s", w32_strerror (0));
|
||||||
if( !nread )
|
if( !nread )
|
||||||
continue;
|
continue;
|
||||||
if( *cbuf == '\n' )
|
if( *cbuf == '\n' )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user