Author: baggins                      Date: Fri Oct  3 22:49:05 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- strtok sucks

---- Files affected:
SOURCES:
   bsd-finger-iconv.patch (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SOURCES/bsd-finger-iconv.patch
diff -u SOURCES/bsd-finger-iconv.patch:1.1 SOURCES/bsd-finger-iconv.patch:1.2
--- SOURCES/bsd-finger-iconv.patch:1.1  Fri Oct  3 23:23:51 2008
+++ SOURCES/bsd-finger-iconv.patch      Sat Oct  4 00:48:59 2008
@@ -1,6 +1,6 @@
 diff -ur bsd-finger-0.17/finger/util.c bsd-finger-0.17-iconv/finger/util.c
---- bsd-finger-0.17/finger/util.c      2008-10-03 23:13:12.000000000 +0200
-+++ bsd-finger-0.17-iconv/finger/util.c        2008-10-03 23:11:21.000000000 
+0200
+--- bsd-finger-0.17/finger/util.c      2008-10-04 00:48:15.000000000 +0200
++++ bsd-finger-0.17-iconv/finger/util.c        2008-10-04 00:47:47.000000000 
+0200
 @@ -53,6 +53,14 @@
  #include <stdlib.h>
  #include "finger.h"
@@ -16,23 +16,40 @@
  #define       HBITS   8                       /* number of bits in hash code 
*/
  #define       HSIZE   (1 << 8)                /* hash table size */
  #define       HMASK   (HSIZE - 1)             /* hash code mask */
-@@ -227,6 +235,54 @@
+@@ -183,7 +191,7 @@
+ {
+       char *p;
+       int i, j, ct, rv=0;
+-      char *rname;
++      char *rname, *irname = NULL;
+ 
+       strncpy(tbuf, pw->pw_gecos, TBUFLEN);
+       tbuf[TBUFLEN-1] = 0;  /* guarantee null termination */
+@@ -222,11 +230,62 @@
+           }
+       }
+       rname[j] = 0;
++#if defined(HAVE_LANGINFO_H) && defined(HAVE_ICONV)
++      irname = malloc(2*strlen(rname) + 1);
++      if (irname)
++              strcpy(irname, rname);
++#endif
+ 
+       for (p = strtok(rname, "\t "); p && !rv; p = strtok(NULL, "\t ")) {
            if (!strcasecmp(p, user)) 
                rv = 1;
        }
 +
 +#if defined(HAVE_LANGINFO_H) && defined(HAVE_ICONV)
-+      if (!rv && has_locale) {
-+              char *irname, *iuser, *inbuf, *outbuf;
++      if (!rv && has_locale && irname) {
++              char *iuser, *inbuf, *outbuf;
 +              iconv_t cd;
 +              size_t il, ol;
 +
-+              irname = malloc(2*strlen(rname) + 1);
-+              if (!irname)
-+                      goto done;
 +              iuser = malloc(2*strlen(user) + 1);
 +              if (!iuser)
-+                      goto done_rname;
++                      goto done;
++              strcpy(rname, irname);
 +              memset(iuser, 0, 2*strlen(user) + 1);
 +              memset(irname, 0, 2*strlen(rname) + 1);
 +
@@ -63,10 +80,10 @@
 +              iconv_close(cd);
 +done_user:
 +              free(iuser);
-+done_rname:
-+              free(irname);
 +      }
 +done:
++      if (irname)
++              free(irname);
 +#endif
        free(rname);
  
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/bsd-finger-iconv.patch?r1=1.1&r2=1.2&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to