Memset fails on Solaris


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Old 10-17-2014
Memset fails on Solaris

Hi,

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

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

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

# 2  
Old 10-23-2014
Might go haywire if called with n loaded from negative integer ( -1 = 0xFFFFFFFF )?
Code:
void *memset( void *dst, int c, size_t n ){
 
    char *d = dst;
 
    while ( n ) {
         --n ;
         *d  =  c  ;
         d++ ;
     }
 
     return dst;
 }

# 3  
Old 10-25-2014
"Fails" is hardly specific enough for anyone to address what's wrong.

How does it fail?
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Find command works on Linux but fails on Solaris. mohtashims Shell Programming and Scripting 1 07-02-2018 05:51 PM
sed works on Linux but fails on Solaris mohtashims Shell Programming and Scripting 4 06-01-2016 06:51 AM
awk works on Linux but fails on Solaris mohtashims Shell Programming and Scripting 5 05-26-2016 12:22 AM
Grep works on Linux but fails on Solaris mohtashims Shell Programming and Scripting 6 05-25-2016 11:56 PM
Solaris: clnt_create fails on solaris x86 DivakarAdari Solaris 0 05-09-2011 03:08 AM
C bzero() to memset() issue Jess83 Programming 4 01-21-2010 05:21 AM
application Crashes on memset ?? any suggestions sudharma Solaris 2 10-13-2009 10:36 AM
Solaris 10 install fails on sparc imagtek Solaris 5 09-02-2009 03:42 PM
ldap client fails to start under solaris 10 aixlover Solaris 3 04-16-2009 06:24 PM
memset vs calloc salvi UNIX for Advanced & Expert Users 7 07-17-2008 07:17 PM
questions in memset arunkumar_mca UNIX for Dummies Questions & Answers 7 08-09-2007 12:08 PM
pkgadd fails when installing Solaris 8 patches Deicide5997 UNIX for Dummies Questions & Answers 5 09-24-2006 11:04 AM
test program(dlopen) fails on hp but run well on solaris shriashishpatil HP-UX 2 03-19-2006 11:55 PM
about memset fuction ranj@chn Programming 3 01-31-2006 07:59 AM
Solaris 2.6 exec login fails rambo15 Shell Programming and Scripting 2 06-10-2004 07:02 PM