mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Fixed references to errno in MSVCRT to use __set_errno() and _errno() respectively. Fixed warning (args 3 & 6 in call to CreateThread) in lib/msvcrt/process/threadx.c
svn path=/trunk/; revision=5137
This commit is contained in:
parent
8082dee891
commit
e847eaa655
14 changed files with 34 additions and 24 deletions
|
@ -1,3 +1,10 @@
|
|||
2003-07-15 Royce Mitchell III <royce3@ev1.net>
|
||||
|
||||
* fixed references to errno in MSVCRT to use __set_errno() and
|
||||
_errno() respectively.
|
||||
* Fixed warning (args 3 & 6 in call to CreateThread) in
|
||||
lib/msvcrt/process/threadx.c
|
||||
|
||||
2003-07-15 Royce Mitchell III <royce3@ev1.net>
|
||||
|
||||
* modified crtdll to forward most of it's CTYPE, STRING
|
||||
|
|
|
@ -16,12 +16,12 @@ __int64 _lseeki64(int _fildes, __int64 _offset, int _whence)
|
|||
offset.QuadPart = _offset;
|
||||
|
||||
// if (invalid_filehnd(_fildes)) {
|
||||
// errno = EBADF;
|
||||
// __set_errno ( EBADF );
|
||||
// return -1L;
|
||||
// }
|
||||
if (SetFilePointerEx((HANDLE)filehnd(_fildes), offset, &new_pos, _whence)) {
|
||||
} else {
|
||||
//errno = EINVAL;
|
||||
//__set_errno ( EINVAL );
|
||||
return -1L;
|
||||
}
|
||||
return new_pos.QuadPart;
|
||||
|
|
|
@ -13,4 +13,5 @@ void _assert(const char *msg, const char *file, int line)
|
|||
/* Assertion failed at foo.c line 45: x<y */
|
||||
fprintf(stderr, "Assertion failed at %s line %d: %s\n", file, line, msg);
|
||||
raise(SIGABRT);
|
||||
for(;;); /* eliminate warning by mingw */
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: process.c,v 1.5 2003/07/11 21:58:09 royce Exp $ */
|
||||
/* $Id: process.c,v 1.6 2003/07/16 02:45:24 royce Exp $ */
|
||||
#include <msvcrt/process.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/string.h>
|
||||
|
@ -176,18 +176,18 @@ do_spawn(int mode, const char* cmdname, const char* args, const char* envp)
|
|||
|
||||
if (mode != _P_NOWAIT && mode != _P_NOWAITO && mode != _P_WAIT && mode != _P_DETACH && mode != _P_OVERLAY)
|
||||
{
|
||||
errno = EINVAL;
|
||||
__set_errno ( EINVAL );
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (0 != _access(cmdname, F_OK))
|
||||
{
|
||||
errno = ENOENT;
|
||||
__set_errno ( ENOENT );
|
||||
return -1;
|
||||
}
|
||||
if (0 == _access(cmdname, D_OK))
|
||||
{
|
||||
errno = EISDIR;
|
||||
__set_errno ( EISDIR );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ do_spawn(int mode, const char* cmdname, const char* args, const char* envp)
|
|||
StartupInfo.lpReserved2 = malloc(StartupInfo.cbReserved2);
|
||||
if (StartupInfo.lpReserved2 == NULL)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
__set_errno ( ENOMEM );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: thread.c,v 1.6 2003/07/11 21:58:09 royce Exp $
|
||||
/* $Id: thread.c,v 1.7 2003/07/16 02:45:24 royce Exp $
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
|
@ -14,7 +14,7 @@ unsigned long _beginthread(
|
|||
unsigned stack_size,
|
||||
void* arglist)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
__set_errno ( ENOSYS );
|
||||
return (unsigned long)-1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: threadx.c,v 1.3 2003/07/11 21:58:09 royce Exp $
|
||||
/* $Id: threadx.c,v 1.4 2003/07/16 02:45:24 royce Exp $
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
|
@ -23,11 +23,13 @@ unsigned long _beginthreadex(
|
|||
* Just call the API function. Any CRT specific processing is done in
|
||||
* DllMain DLL_THREAD_ATTACH
|
||||
*/
|
||||
NewThread = CreateThread(security, stack_size, start_address, arglist, initflag, thrdaddr);
|
||||
NewThread = CreateThread ( security, stack_size,
|
||||
(LPTHREAD_START_ROUTINE)start_address,
|
||||
arglist, initflag, (PULONG)thrdaddr );
|
||||
if (NULL == NewThread)
|
||||
{
|
||||
/* FIXME map GetLastError() to errno */
|
||||
errno = ENOSYS;
|
||||
__set_errno ( ENOSYS );
|
||||
}
|
||||
|
||||
return (unsigned long) NewThread;
|
||||
|
|
|
@ -32,11 +32,11 @@ int fflush(FILE *f)
|
|||
|
||||
if (f == NULL)
|
||||
{
|
||||
int e = errno;
|
||||
int e = *_errno();
|
||||
|
||||
__set_errno(0);
|
||||
_fwalk((void (*)(FILE *))fflush);
|
||||
if (errno)
|
||||
if (*_errno())
|
||||
return EOF;
|
||||
__set_errno(e);
|
||||
return 0;
|
||||
|
|
|
@ -12,6 +12,6 @@ int fgetpos(FILE *stream, fpos_t *pos)
|
|||
*pos = (fpos_t)ftell(stream);
|
||||
return 0;
|
||||
}
|
||||
//errno = EFAULT;
|
||||
//__set_errno ( EFAULT );
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ int _filbuf(FILE* f)
|
|||
f->_flag |= _IOERR;
|
||||
f->_cnt = 0;
|
||||
|
||||
// should set errno
|
||||
// FIXME should set errno
|
||||
|
||||
return EOF;
|
||||
}
|
||||
|
|
|
@ -38,9 +38,9 @@ tmpfile(void)
|
|||
retries the call to `tmpnam' until we actually succeed
|
||||
to create the file which didn't exist before. */
|
||||
do {
|
||||
// errno = 0;
|
||||
// __set_errno ( 0 );
|
||||
temp_fd = _open(temp_name, 0, SH_DENYRW);
|
||||
// if ( errno == ENOENT )
|
||||
// if ( *_errno() == ENOENT )
|
||||
// break;
|
||||
} while (temp_fd == -1 && (temp_name = tmpnam(0)) != 0);
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
|
|||
if (skip_space)
|
||||
{
|
||||
while (isspace (c))
|
||||
if (inchar () == EOF && errno == EINTR)
|
||||
if (inchar () == EOF && *_errno() == EINTR)
|
||||
conv_error ();
|
||||
skip_space = 0;
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
|
|||
conv_error ();
|
||||
|
||||
/* We must take care for EINTR errors. */
|
||||
if (c == EOF && errno == EINTR)
|
||||
if (c == EOF && *_errno() == EINTR)
|
||||
input_error ();
|
||||
|
||||
/* Find the conversion specifier. */
|
||||
|
@ -353,7 +353,7 @@ int __vfscanf (FILE *s, const char *format, va_list argptr)
|
|||
{
|
||||
/* Eat whitespace. */
|
||||
do
|
||||
if (inchar () == EOF && errno == EINTR)
|
||||
if (inchar () == EOF && *_errno() == EINTR)
|
||||
input_error ();
|
||||
while (isspace (c));
|
||||
ungetc (c, s);
|
||||
|
|
|
@ -74,7 +74,7 @@ strtoll(const char *nptr, char **endptr, int base)
|
|||
if (any < 0)
|
||||
{
|
||||
acc = neg ? LLONG_MIN : LLONG_MAX;
|
||||
errno = ERANGE;
|
||||
__set_errno ( ERANGE );
|
||||
}
|
||||
else if (neg)
|
||||
acc *= -1;
|
||||
|
|
|
@ -66,7 +66,7 @@ strtoull(const char *nptr, char **endptr, int base)
|
|||
if (any < 0)
|
||||
{
|
||||
acc = ULONG_MAX;
|
||||
errno = ERANGE;
|
||||
__set_errno ( ERANGE );
|
||||
}
|
||||
else if (neg)
|
||||
acc = -acc;
|
||||
|
|
|
@ -108,7 +108,7 @@ char *strerror(int errnum)
|
|||
char *_strerror(const char *s)
|
||||
{
|
||||
if ( s == NULL )
|
||||
return strerror(errno);
|
||||
return strerror(*_errno());
|
||||
|
||||
return strerror(atoi(s));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue