forked from KolibriOS/kolibrios
newlib: fixed error handling in write()
git-svn-id: svn://kolibrios.org@6330 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f29da4d0ec
commit
b141c63200
@ -40,9 +40,10 @@ int _EXFUN(toascii, (int __c));
|
|||||||
#define _B 0200
|
#define _B 0200
|
||||||
|
|
||||||
#ifndef _MB_CAPABLE
|
#ifndef _MB_CAPABLE
|
||||||
_CONST
|
extern _CONST __IMPORT char *__ctype_ptr__;
|
||||||
#endif
|
#else
|
||||||
extern __IMPORT char *__ctype_ptr__;
|
extern __IMPORT char *__ctype_ptr__;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
/* These macros are intentionally written in a manner that will trigger
|
/* These macros are intentionally written in a manner that will trigger
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/kos_io.h>
|
#include <sys/kos_io.h>
|
||||||
|
|
||||||
int write_file(const char *path,const void *buff,
|
int write_file(const char *path,const void *buff,
|
||||||
@ -24,5 +25,9 @@ int write_file(const char *path,const void *buff,
|
|||||||
"addl $28, %%esp \n\t"
|
"addl $28, %%esp \n\t"
|
||||||
:"=a" (retval)
|
:"=a" (retval)
|
||||||
:"a"(path),"b"(buff),"c"(offset),"d"(count),"S"(writes));
|
:"a"(path),"b"(buff),"c"(offset),"d"(count),"S"(writes));
|
||||||
return retval;
|
if(retval == 0)
|
||||||
|
return 0;
|
||||||
|
else if (retval == 8)
|
||||||
|
return ENOSPC;
|
||||||
|
return -1;
|
||||||
};
|
};
|
||||||
|
@ -86,9 +86,10 @@ static int os_write(int handle, const void *buffer, unsigned len, unsigned *amt
|
|||||||
|
|
||||||
ioh->offset+= *amt;
|
ioh->offset+= *amt;
|
||||||
|
|
||||||
if( *amt != len )
|
if( *amt && *amt != len )
|
||||||
{
|
{
|
||||||
rc = ENOSPC;
|
rc = ENOSPC;
|
||||||
|
errno = rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return( rc );
|
return( rc );
|
||||||
|
Loading…
Reference in New Issue
Block a user