File multipath-tools-shuffle-memarea-init of Package multipath-tools

commit a8c6e0c6da02d83b86280dbd1162c44f8cefb53f
Author: Hannes Reinecke <hare@suse.de>
Date:   Wed Jan 7 10:59:46 2009 +0100

    Shuffle to the call to memset in logarea_init()
    
    We should call memset only after we know the area has been
    allocated.
    
    Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/libmultipath/log.c b/libmultipath/log.c
index 0dd1c22..0cf5047 100644
--- a/libmultipath/log.c
+++ b/libmultipath/log.c
@@ -47,12 +47,11 @@ static int logarea_init (int size)
 		size = DEFAULT_AREA_SIZE;
 
 	la->start = MALLOC(size);
-	memset(la->start, 0, size);
-
 	if (!la->start) {
 		FREE(la);
 		return 1;
 	}
+	memset(la->start, 0, size);
 
 	la->empty = 1;
 	la->end = la->start + size;
@@ -143,7 +142,7 @@ int log_enqueue (int prio, const char * fmt, va_list ap)
 	la->empty = 0;
 	msg = (struct logmsg *)la->tail;
 	msg->prio = prio;
-	memcpy((void *)&msg->str, buff, strlen(buff));
+	strcpy((void *)&msg->str, buff);
 	lastmsg->next = la->tail;
 	msg->next = la->head;
 
openSUSE Build Service is sponsored by