rpms/rarpd/devel rarpd-sprintf.patch,NONE,1.1 rarpd.spec,1.13,1.14

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Jul 26 16:38:52 UTC 2005


Author: pknirsch

Update of /cvs/dist/rpms/rarpd/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv32185

Modified Files:
	rarpd.spec 
Added Files:
	rarpd-sprintf.patch 
Log Message:
- Fixed and optimized loop with sprintf usage
- Added missing stdlib.h include


rarpd-sprintf.patch:
 rarpd.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

--- NEW FILE rarpd-sprintf.patch ---
--- rarpd/rarpd.c.sprintf	2005-07-26 18:14:47.000000000 +0200
+++ rarpd/rarpd.c	2005-07-26 18:18:42.000000000 +0200
@@ -11,6 +11,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <syslog.h>
 #include <dirent.h>
 #include <malloc.h>
@@ -457,15 +458,12 @@
 		return;
 
 	ptr = tmpbuf;
-	for (i=0; i<sll.sll_halen; i++) {
-		if (i) {
-			sprintf(ptr, ":%02x", sll.sll_addr[i]);
-			ptr++;
-		} else
-			sprintf(ptr, "%02x", sll.sll_addr[i]);
-		ptr += 2;
+        snprintf(tmpbuf, 2, "%02x", sll.sll_addr[0]);
+	for (ptr=tmpbuf+2, i=1; i<sll.sll_halen; i++) {
+		snprintf(ptr, 3, ":%02x", sll.sll_addr[i]);
+		ptr += 3;
 	}
-	
+
 	for (ifl=ifl_list; ifl; ifl = ifl->next)
 		if (ifl->index == sll.sll_ifindex)
 			break;


Index: rarpd.spec
===================================================================
RCS file: /cvs/dist/rpms/rarpd/devel/rarpd.spec,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- rarpd.spec	14 Jul 2005 10:25:32 -0000	1.13
+++ rarpd.spec	26 Jul 2005 16:38:49 -0000	1.14
@@ -1,7 +1,7 @@
 Summary: The RARP daemon.
 Name: rarpd
 Version: ss981107
-Release: 21
+Release: 22
 License: GPL
 Group: System Environment/Daemons
 Source: ftp://ftp.inr.ac.ru/ip-routing/dhcp.bootp.rarp/rarpd-%{version}.tar.gz
@@ -9,6 +9,7 @@
 Patch1: rarpd-norun.patch
 Patch2: rarpd-initscript.patch
 Patch3: rarpd-fd-leak.patch
+Patch4: rarpd-sprintf.patch
 Prereq: /sbin/chkconfig
 Buildroot: %{_tmppath}/%{name}-%{version}-root
 
@@ -29,6 +30,7 @@
 %patch1 -p1 -b .norun
 %patch2 -p1 -b .initscript
 %patch3 -p1 -b .fd-leak
+%patch4 -p1 -b .sprintf
 
 %build
 %ifarch s390 s390x
@@ -74,6 +76,10 @@
 %{_mandir}/man8/*
 
 %changelog
+* Tue Jul 26 2005 Phil Knirsch <pknirsch at redhat.com> ss981107-22
+- Fixed and optimized loop with sprintf usage
+- Added missing stdlib.h include
+
 * Thu Jul 14 2005 Phil Knirsch <pknirsch at redhat.com> ss981107-21
 - Fix for leak socket descriptors (#162000)
 




More information about the fedora-cvs-commits mailing list