mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
common: Strip trailing CR,LF from w32_strerror.
* common/stringhelp.c (w32_strerror): Strip trailing CR,LF. * common/iobuf.c (iobuf_get_filelength): Use -1 and not 0 for the arg to w32_strerror. -- This is in particular annoying since we started to use a string argument sanitizer in the logging code. Before that we just add an extra blank line. The second patch corrects a never yet seen error message. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
ba873216ff
commit
33fd55ca6f
2 changed files with 7 additions and 1 deletions
|
@ -789,6 +789,12 @@ w32_strerror (int ec)
|
|||
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, ec,
|
||||
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
strerr, DIM (strerr)-1, NULL);
|
||||
{
|
||||
/* Strip the CR,LF - we want just the string. */
|
||||
size_t n = strlen (strerr);
|
||||
if (n > 2 && strerr[n-2] == '\r' && strerr[n-1] == '\n' )
|
||||
strerr[n-2] = 0;
|
||||
}
|
||||
#endif
|
||||
return strerr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue