diff --git a/contrib/sdk/sources/newlib/libc/include/ctype.h b/contrib/sdk/sources/newlib/libc/include/ctype.h index 969d3ef1f3..9bd69c9c1c 100644 --- a/contrib/sdk/sources/newlib/libc/include/ctype.h +++ b/contrib/sdk/sources/newlib/libc/include/ctype.h @@ -40,9 +40,10 @@ int _EXFUN(toascii, (int __c)); #define _B 0200 #ifndef _MB_CAPABLE -_CONST +extern _CONST __IMPORT char *__ctype_ptr__; +#else +extern __IMPORT char *__ctype_ptr__; #endif -extern __IMPORT char *__ctype_ptr__; #ifndef __cplusplus /* These macros are intentionally written in a manner that will trigger diff --git a/contrib/sdk/sources/newlib/libc/sys/iowrite.c b/contrib/sdk/sources/newlib/libc/sys/iowrite.c index a92814f452..c82ae86c7a 100644 --- a/contrib/sdk/sources/newlib/libc/sys/iowrite.c +++ b/contrib/sdk/sources/newlib/libc/sys/iowrite.c @@ -1,28 +1,33 @@ #include +#include #include int write_file(const char *path,const void *buff, size_t offset, size_t count, size_t *writes) { - int retval; - __asm__ __volatile__( - "pushl $0 \n\t" - "pushl $0 \n\t" - "movl %%eax, 1(%%esp) \n\t" - "pushl %%ebx \n\t" - "pushl %%edx \n\t" - "pushl $0 \n\t" - "pushl %%ecx \n\t" - "pushl $3 \n\t" - "movl %%esp, %%ebx \n\t" - "mov $70, %%eax \n\t" - "int $0x40 \n\t" - "testl %%esi, %%esi \n\t" - "jz 1f \n\t" - "movl %%ebx, (%%esi) \n\t" + int retval; + __asm__ __volatile__( + "pushl $0 \n\t" + "pushl $0 \n\t" + "movl %%eax, 1(%%esp) \n\t" + "pushl %%ebx \n\t" + "pushl %%edx \n\t" + "pushl $0 \n\t" + "pushl %%ecx \n\t" + "pushl $3 \n\t" + "movl %%esp, %%ebx \n\t" + "mov $70, %%eax \n\t" + "int $0x40 \n\t" + "testl %%esi, %%esi \n\t" + "jz 1f \n\t" + "movl %%ebx, (%%esi) \n\t" "1:" - "addl $28, %%esp \n\t" - :"=a" (retval) - :"a"(path),"b"(buff),"c"(offset),"d"(count),"S"(writes)); - return retval; + "addl $28, %%esp \n\t" + :"=a" (retval) + :"a"(path),"b"(buff),"c"(offset),"d"(count),"S"(writes)); + if(retval == 0) + return 0; + else if (retval == 8) + return ENOSPC; + return -1; }; diff --git a/contrib/sdk/sources/newlib/libc/sys/write.c b/contrib/sdk/sources/newlib/libc/sys/write.c index f30edfd931..9fa78d2ba9 100644 --- a/contrib/sdk/sources/newlib/libc/sys/write.c +++ b/contrib/sdk/sources/newlib/libc/sys/write.c @@ -86,9 +86,10 @@ static int os_write(int handle, const void *buffer, unsigned len, unsigned *amt ioh->offset+= *amt; - if( *amt != len ) + if( *amt && *amt != len ) { rc = ENOSPC; + errno = rc; } return( rc );