diff -urN hsfmodem-7.18.00.05x86_64full/modules/GPL/oscompat.h hsfmodem-7.18.00.05x86_64full-errno/modules/GPL/oscompat.h --- hsfmodem-7.18.00.05x86_64full/modules/GPL/oscompat.h 2005-06-20 19:18:46.000000000 +0000 +++ hsfmodem-7.18.00.05x86_64full-errno/modules/GPL/oscompat.h 2005-06-29 16:20:54.000000000 +0000 @@ -72,7 +72,7 @@ #include #include -#if defined(STATIC_ERRNO) && !defined(__x86_64__) +#if defined(STATIC_ERRNO) #ifndef _LINUX_UNISTD_H_ #define _LINUX_UNISTD_H_ #endif diff -urN hsfmodem-7.18.00.05x86_64full/modules/include/osstdio.h hsfmodem-7.18.00.05x86_64full-errno/modules/include/osstdio.h --- hsfmodem-7.18.00.05x86_64full/modules/include/osstdio.h 2004-12-14 07:45:53.000000000 +0000 +++ hsfmodem-7.18.00.05x86_64full-errno/modules/include/osstdio.h 2005-06-29 16:20:54.000000000 +0000 @@ -40,9 +40,9 @@ __shimcall__ FILE * OsFOpen(const char *, const char *, int *); __shimcall__ -size_t OsFRead(void *, size_t, size_t, FILE *); +size_t OsFRead(void *, size_t, size_t, FILE *, int *); __shimcall__ -size_t OsFWrite(const void *, size_t, size_t, FILE *); +size_t OsFWrite(const void *, size_t, size_t, FILE *, int *); __shimcall__ int OsFClose(FILE *); __shimcall__ diff -urN hsfmodem-7.18.00.05x86_64full/modules/osnvm.c hsfmodem-7.18.00.05x86_64full-errno/modules/osnvm.c --- hsfmodem-7.18.00.05x86_64full/modules/osnvm.c 2005-06-20 17:53:21.000000000 +0000 +++ hsfmodem-7.18.00.05x86_64full-errno/modules/osnvm.c 2005-06-29 16:20:54.000000000 +0000 @@ -7,8 +7,6 @@ * */ -#define STATIC_ERRNO - #include "oscompat.h" #include "osservices.h" #include "osmemory.h" @@ -418,6 +416,7 @@ char buf[MAX_OEM_STR_LEN + 4], *dp; unsigned char *p; UINT32 size; + int errno; p = pBuf; dp = buf; @@ -428,7 +427,7 @@ dp += 3; if(((size) % 16) == 0) { *dp++ = '\n'; - if (OsFWrite(buf, 1, dp - buf, file) != (dp - buf)) { + if (OsFWrite(buf, 1, dp - buf, file, &errno) != (dp - buf)) { printk(KERN_ERR "%s: write error to %s errno=%d\n", __FUNCTION__, pathname, errno); goto err; } @@ -445,7 +444,7 @@ dp += 5; if(((size) % 16) == 0) { *dp++ = '\n'; - if (OsFWrite(buf, 1, dp - buf, file) != (dp - buf)) { + if (OsFWrite(buf, 1, dp - buf, file, &errno) != (dp - buf)) { printk(KERN_ERR "%s: write error to %s errno=%d\n", __FUNCTION__, pathname, errno); goto err; } @@ -463,7 +462,7 @@ dp += 9; if(((size) % 16) == 0) { *dp++ = '\n'; - if (OsFWrite(buf, 1, dp - buf, file) != (dp - buf)) { + if (OsFWrite(buf, 1, dp - buf, file, &errno) != (dp - buf)) { printk(KERN_ERR "%s: write error to %s errno=%d\n", __FUNCTION__, pathname, errno); goto err; } @@ -491,7 +490,7 @@ } if(dp - buf) { - if (OsFWrite(buf, 1, dp - buf, file) != (dp - buf)) { + if (OsFWrite(buf, 1, dp - buf, file, &errno) != (dp - buf)) { printk(KERN_ERR "%s: write error to %s errno=%d\n", __FUNCTION__, pathname, errno); goto err; } @@ -601,6 +600,7 @@ UINT32 l; int n; struct list_head *lh; + int errno; down(&nvmelem_writelist_sem); for(lh = nvmelem_writelist.prev; lh != &nvmelem_writelist; lh = lh->prev) { @@ -634,7 +634,7 @@ printk(KERN_DEBUG"%s: opened %s\n", __FUNCTION__, pathname); while(l > 0) { - n = OsFRead(buf, 1, sizeof(buf)-1, file); + n = OsFRead(buf, 1, sizeof(buf)-1, file, &errno); if(n <= 0) break; @@ -682,7 +682,7 @@ /* value split accross buffer boundary, read next chunk */ buf[0] = *p; p = buf; - n = OsFRead(buf+1, 1, sizeof(buf)-1-1, file); + n = OsFRead(buf+1, 1, sizeof(buf)-1-1, file, &errno); if(n < 0) { break; } diff -urN hsfmodem-7.18.00.05x86_64full/modules/osstdio.c hsfmodem-7.18.00.05x86_64full-errno/modules/osstdio.c --- hsfmodem-7.18.00.05x86_64full/modules/osstdio.c 2004-12-14 07:44:26.000000000 +0000 +++ hsfmodem-7.18.00.05x86_64full-errno/modules/osstdio.c 2005-06-29 16:22:33.000000000 +0000 @@ -137,7 +137,7 @@ __shimcall__ size_t -OsFRead(void *ptr, size_t size, size_t nmemb, FILE *filp) +OsFRead(void *ptr, size_t size, size_t nmemb, FILE *filp, int *errno_p) { int bytes; @@ -154,6 +154,8 @@ set_fs(oldfs); } + if (errno_p && bytes < 0) *errno_p = -(bytes); + if(bytes < 0) { printk(KERN_ERR "%s(filp %p): error %d\n", __FUNCTION__, filp, bytes); return 0; @@ -163,7 +165,7 @@ __shimcall__ size_t -OsFWrite(const void *ptr, size_t size, size_t nmemb, FILE *filp) +OsFWrite(const void *ptr, size_t size, size_t nmemb, FILE *filp, int *errno_p) { int bytes; @@ -180,6 +182,8 @@ set_fs(oldfs); } + if (errno_p && bytes < 0) *errno_p = -(bytes); + if(bytes < 0) { printk(KERN_ERR "%s(filp %p): error %d\n", __FUNCTION__, filp, bytes); return 0;