* dcrt0.cc (__api_fatal): Drop spare argument to __small_sprintf.

* smallprint.c (__small_vsprintf): Preserve GetLastError value.
	* winsup.h (api_fatal): Simplify.  Drop duplicate filename arg.
This commit is contained in:
Corinna Vinschen 2006-10-27 10:41:51 +00:00
parent 6aea277648
commit 17f3068d4e
4 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2006-10-27 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (__api_fatal): Drop spare argument to __small_sprintf.
* smallprint.c (__small_vsprintf): Preserve GetLastError value.
* winsup.h (api_fatal): Simplify. Drop duplicate filename arg.
2006-10-23 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Fix comment.

View File

@ -1151,7 +1151,7 @@ __api_fatal (const char *fmt, ...)
va_list ap;
va_start (ap, fmt);
int n = __small_sprintf (buf, "%P: *** fatal error - ", cygwin_pid (GetCurrentProcessId ()));
int n = __small_sprintf (buf, "%P: *** fatal error - ");
__small_vsprintf (buf + n, fmt, ap);
va_end (ap);
strace.prntf (_STRACE_SYSTEM, NULL, "%s", buf);

View File

@ -71,6 +71,8 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
char *orig = dst;
const char *s;
DWORD err = GetLastError ();
while (*fmt)
{
int i, n = 0x7fff;
@ -125,7 +127,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
break;
case 'E':
strcpy (dst, "Win32 error ");
dst = __rn (dst + sizeof ("Win32 error"), 10, 0, GetLastError (), len, pad, LMASK);
dst = __rn (dst + sizeof ("Win32 error"), 10, 0, err, len, pad, LMASK);
break;
case 'd':
dst = rnarg (dst, 10, addsign, len, pad);
@ -180,6 +182,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
}
}
*dst = 0;
SetLastError (err);
return dst - orig;
}

View File

@ -154,7 +154,7 @@ extern unsigned int signal_shift_subtract;
extern int __api_fatal_exit_val;
#define set_api_fatal_return(n) do {extern int __api_fatal_exit_val; __api_fatal_exit_val = (n);} while (0)
#define api_fatal(fmt, args...) __api_fatal ("%P: *** " fmt,## args)
#define api_fatal(fmt, args...) __api_fatal (fmt,## args)
#undef issep
#define issep(ch) (strchr (" \t\n\r", (ch)) != NULL)