Apparently it's OK for done to be NULL, which was not clear in the
Solaris man page. Anyway, since apparently this usage is accectable I've updated the function to handle it. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@63 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
parent
6a585c61de
commit
0998fdd6db
|
@ -37,6 +37,8 @@ copyout(const void *from, void *to, size_t len)
|
||||||
static __inline__ int
|
static __inline__ int
|
||||||
copyinstr(const void *from, void *to, size_t len, size_t *done)
|
copyinstr(const void *from, void *to, size_t len, size_t *done)
|
||||||
{
|
{
|
||||||
|
size_t rc;
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return -ENAMETOOLONG;
|
return -ENAMETOOLONG;
|
||||||
|
|
||||||
|
@ -46,7 +48,9 @@ copyinstr(const void *from, void *to, size_t len, size_t *done)
|
||||||
/* XXX: Should return ENAMETOOLONG if 'strlen(from) > len' */
|
/* XXX: Should return ENAMETOOLONG if 'strlen(from) > len' */
|
||||||
|
|
||||||
memset(to, 0, len);
|
memset(to, 0, len);
|
||||||
*done = copyin(from, to, len - 1);
|
rc = copyin(from, to, len - 1);
|
||||||
|
if (done != NULL)
|
||||||
|
*done = rc;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue