pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/cmu-dhcpd Fix errno and strerror. Prefer NAME_MAX....



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4ce5b649402a
branches:  trunk
changeset: 509747:4ce5b649402a
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Tue Mar 14 02:21:46 2006 +0000

description:
Fix errno and strerror. Prefer NAME_MAX. Fix a number of sprintf usages
to use snprintf while here.

diffstat:

 net/cmu-dhcpd/distinfo         |    5 +-
 net/cmu-dhcpd/patches/patch-ad |  115 +++++++++++++++++++++++++++++++++++++++++
 net/cmu-dhcpd/patches/patch-ae |   12 ++++
 net/cmu-dhcpd/patches/patch-af |   22 +++++++
 4 files changed, 153 insertions(+), 1 deletions(-)

diffs (177 lines):

diff -r 2c9c74161794 -r 4ce5b649402a net/cmu-dhcpd/distinfo
--- a/net/cmu-dhcpd/distinfo    Tue Mar 14 02:10:10 2006 +0000
+++ b/net/cmu-dhcpd/distinfo    Tue Mar 14 02:21:46 2006 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.3 2005/02/24 12:13:44 agc Exp $
+$NetBSD: distinfo,v 1.4 2006/03/14 02:21:46 joerg Exp $
 
 SHA1 (CMU-dhcp-3.3.7+PU-9.tar.Z) = 9c7eb8f498eddd35d0eb9ceaa90451f06bb5cf27
 RMD160 (CMU-dhcp-3.3.7+PU-9.tar.Z) = b426f5580771ef635a34c336d0422cc31dd934d2
@@ -6,3 +6,6 @@
 SHA1 (patch-aa) = bbedb6f3c01d6459f5e0623e8e165ecef6d09374
 SHA1 (patch-ab) = 94a2fa4094d8a494db3188dc1a415ed5eb2642bb
 SHA1 (patch-ac) = 0729cc8ff71b57fba0975b802ed4cbcfaeb78a5b
+SHA1 (patch-ad) = 25771145085881630fbc807ad2537e254f144161
+SHA1 (patch-ae) = 648f6fe130c060c926ba6d43508701bbf7c0cfbd
+SHA1 (patch-af) = 2d355ecde64da2ea5d9f1afdb608884691ccd0f0
diff -r 2c9c74161794 -r 4ce5b649402a net/cmu-dhcpd/patches/patch-ad
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/cmu-dhcpd/patches/patch-ad    Tue Mar 14 02:21:46 2006 +0000
@@ -0,0 +1,115 @@
+$NetBSD: patch-ad,v 1.1 2006/03/14 02:21:46 joerg Exp $
+
+--- hashf.c.orig       2006-03-14 02:10:26.000000000 +0000
++++ hashf.c
+@@ -33,6 +33,7 @@ SOFTWARE.
+ 
+ 
+ #include <sys/types.h>
++#include <limits.h>
+ #include <stdlib.h>
+ 
+ #ifndef USE_BFUNCS
+@@ -168,10 +169,14 @@ hashf_Exists(hashtable, hashcode, compar
+       hash_datum *key;
+ {
+         FILE *fp;
++#if defined(NAME_MAX)
++        char name[NAME_MAX],buf[MAXELEMENTLEN];
++#else
+         char name[MAXNAMLEN],buf[MAXELEMENTLEN];
++#endif
+         int len,rc;
+ 
+-        sprintf(name,"%s/%X",hashtable->dirname,hashcode % hashtable->size);
++        snprintf(name,sizeof(name),"%s/%X",hashtable->dirname,hashcode % hashtable->size);
+         fp=fopen(name,"r");
+         if(!fp)
+                 return FALSE;
+@@ -215,10 +220,14 @@ hashf_Insert(hashtable, hashcode, compar
+       unsigned long elen;
+ {
+       FILE *fp;
++#if defined(NAME_MAX)
++      char name[NAME_MAX],buf[MAXELEMENTLEN];
++#else
+       char name[MAXNAMLEN],buf[MAXELEMENTLEN];
++#endif
+       int rc,len;
+       hashcode %= hashtable->size;
+-      sprintf(name,"%s/%X",hashtable->dirname,hashcode);
++      snprintf(name,sizeof(name),"%s/%X",hashtable->dirname,hashcode);
+ 
+       fp=fopen(name,"a+");
+       if(!fp)
+@@ -265,10 +274,14 @@ hashf_Delete(hashtable, hashcode, compar
+       hash_datum *key;
+ {
+       FILE *fp,*tmp;
++#if defined(NAME_MAX)
++      char name[NAME_MAX],buf[MAXELEMENTLEN];
++#else
+       char name[MAXNAMLEN],buf[MAXELEMENTLEN];
++#endif
+       int rc,len;
+       hashcode %= hashtable->size;
+-      sprintf(name,"%s/%X",hashtable->dirname,hashcode);
++      snprintf(name,sizeof(name),"%s/%X",hashtable->dirname,hashcode);
+ 
+       fp=fopen(name,"r");
+       if(!fp)
+@@ -331,10 +344,14 @@ hashf_Replace(hashtable, hashcode, compa
+       unsigned long elen;
+ {
+       FILE *fp,*tmp;
++#if defined(NAME_MAX)
++      char name[NAME_MAX],buf[MAXELEMENTLEN];
++#else
+       char name[MAXNAMLEN],buf[MAXELEMENTLEN];
++#endif
+       int rc,len;
+       char write,done;
+-      sprintf(name,"%s/%X",hashtable->dirname,hashcode % hashtable->size);
++      snprintf(name,sizeof(name),"%s/%X",hashtable->dirname,hashcode % hashtable->size);
+ 
+       fp=fopen(name,"r");
+       if(!fp)
+@@ -432,11 +449,15 @@ hashf_Lookup(hashtable, hashcode, compar
+       int *length;
+ {
+         FILE *fp;
+-        char name[MAXNAMLEN],buf[MAXELEMENTLEN];
++#if defined(NAME_MAX)
++      char name[NAME_MAX],buf[MAXELEMENTLEN];
++#else
++      char name[MAXNAMLEN],buf[MAXELEMENTLEN];
++#endif
+         int len,rc;
+               hash_datum *p;
+ 
+-        sprintf(name,"%s/%X",hashtable->dirname,hashcode % hashtable->size);
++        snprintf(name,sizeof(name),"%s/%X",hashtable->dirname,hashcode % hashtable->size);
+         fp=fopen(name,"r");
+         if(!fp)
+                 return NULL;
+@@ -479,7 +500,11 @@ hashf_NextEntry(hashtable,length)
+       int *length;
+ {
+       unsigned long len;
++#if defined(NAME_MAX)
++      char name[NAME_MAX];
++#else
+       char name[MAXNAMLEN];
++#endif
+     int rc;
+       hash_datum *p;
+       struct dirent *direntry;
+@@ -494,7 +519,7 @@ hashf_NextEntry(hashtable,length)
+               }while(direntry->d_name[0]=='.');
+               if(hashtable->next)
+                       fclose(hashtable->next);
+-        sprintf(name,"%s/%s",hashtable->dirname,direntry->d_name);
++        snprintf(name,sizeof(name),"%s/%s",hashtable->dirname,direntry->d_name);
+               hashtable->next=fopen(name,"r");
+               rc=fread(&len,4,1,hashtable->next);
+               if(rc==0)
diff -r 2c9c74161794 -r 4ce5b649402a net/cmu-dhcpd/patches/patch-ae
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/cmu-dhcpd/patches/patch-ae    Tue Mar 14 02:21:46 2006 +0000
@@ -0,0 +1,12 @@
+$NetBSD: patch-ae,v 1.1 2006/03/14 02:21:46 joerg Exp $
+
+--- ping.c.orig        2006-03-14 02:14:39.000000000 +0000
++++ ping.c
+@@ -47,7 +47,6 @@ SOFTWARE.
+ 
+ static char buffer[MAXPACKET];
+ static unsigned short sequence =0;
+-extern int errno;
+ #define MAX_DUP_CHK (8 * 128)
+ static int mx_dup_ck = MAX_DUP_CHK;
+ static char rcvd_tbl[MAX_DUP_CHK / 8];
diff -r 2c9c74161794 -r 4ce5b649402a net/cmu-dhcpd/patches/patch-af
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/cmu-dhcpd/patches/patch-af    Tue Mar 14 02:21:46 2006 +0000
@@ -0,0 +1,22 @@
+$NetBSD: patch-af,v 1.1 2006/03/14 02:21:46 joerg Exp $
+
+--- report.c.orig      2006-03-14 02:15:23.000000000 +0000
++++ report.c
+@@ -10,6 +10,7 @@
+ #endif
+ 
+ #include <stdio.h>
++#include <string.h>
+ 
+ #include "defaults.h"
+ #include "report.h"
+@@ -138,9 +139,6 @@ report(priority, fmt, va_alist)
+ char *
+ get_errmsg()
+ {
+-      extern int errno;
+-      extern char *strerror();
+-
+       return strerror(errno);
+ }
+ 



Home | Main Index | Thread Index | Old Index