Memset fails on Solaris

Hi,

memset call is failing on solaris for me. I wrote below code and that also fails. Any hints?

 void *memset(void *dst, int c, size_t n)
 {
     if (n) {
         char *d = dst;

         do {
             *d++ = c;
         } while (--n);
     }
     return dst;
 }

Might go haywire if called with n loaded from negative integer ( -1 = 0xFFFFFFFF )?

void *memset( void *dst, int c, size_t n ){
 
    char *d = dst;
 
    while ( n ) {
         --n ;
         *d  =  c  ;
         d++ ;
     }
 
     return dst;
 }

"Fails" is hardly specific enough for anyone to address what's wrong.

How does it fail?