[Canna-dev 242] Re: cannasever crashed on SLES8 for AMD64

Back to archive index

AIDA Shinra shinr****@j10n*****
2003年 9月 12日 (金) 11:40:02 JST


相田です。

このパッチで直ると思います。可能なら動作確認をお願いします。

Index: lib/RK/fq.c
===================================================================
RCS file: /cvsroot/canna/canna/lib/RK/fq.c,v
retrieving revision 1.4
diff -u -r1.4 fq.c
--- lib/RK/fq.c	19 Mar 2003 12:41:35 -0000	1.4
+++ lib/RK/fq.c	12 Sep 2003 02:35:22 -0000
@@ -377,7 +377,7 @@
      HANDLE fd;
 #endif
 {
-  struct NV	nv, *vn;
+  struct NV	*vn;
   unsigned char	ll[4], *buf, *p;
   long		i, cnt;
 #ifdef WIN
@@ -388,11 +388,11 @@
   if (vn) {
 #ifndef WIN
     if (read(fd, (char *)ll, 4) == 4) {
-      nv.sz = bst4_to_l(ll);
+      vn->sz = bst4_to_l(ll);
       if (read(fd, (char *)ll, 4) == 4) {
 	cnt = bst4_to_l(ll);
 	if (read(fd, (char *)ll, 4) == 4) {
-	  nv.tsz = bst4_to_l(ll);
+	  vn->tsz = bst4_to_l(ll);
 	  if (read(fd, (char *)ll, 4) == 4) {
 	    goto read_ok;
 	  }
@@ -401,11 +401,11 @@
     }
 #else
     if (ReadFile(fd, (char *)ll, 4, &dummy, NULL) && dummy == 4) {
-      nv.sz = bst4_to_l(ll);
+      vn->sz = bst4_to_l(ll);
       if (ReadFile(fd, (char *)ll, 4, &dummy, NULL) && dummy == 4) {
 	cnt = bst4_to_l(ll);
 	if (ReadFile(fd, (char *)ll, 4, &dummy, NULL) && dummy == 4) {
-	  nv.tsz = bst4_to_l(ll);
+	  vn->tsz = bst4_to_l(ll);
 	  if (ReadFile(fd, (char *)ll, 4, &dummy, NULL) && dummy == 4) {
 	    goto read_ok;
 	  }
@@ -419,38 +419,37 @@
 
  read_ok:
 
-  nv.cnt = nv.csz = 0L;
-  nv.head.left = nv.head.right = &nv.head;
-  if (nv.sz) {
-    if (!(nv.buf = (struct NVE **)calloc((size_t)nv.tsz, sizeof(struct NVE *)))) {
+  vn->cnt = vn->csz = 0L;
+  vn->head.left = vn->head.right = &vn->head;
+  if (vn->sz) {
+    if (!(vn->buf = (struct NVE **)calloc((size_t)vn->tsz, sizeof(struct NVE *)))) {
       (void)free((char *)vn);
       return((struct NV *)0);
     }
     if
 #ifndef WIN
-      (!(buf = (unsigned char *)malloc((size_t)nv.sz)) ||
-       read(fd, buf, (unsigned int)nv.sz) != (int)nv.sz)
+      (!(buf = (unsigned char *)malloc((size_t)vn->sz)) ||
+       read(fd, buf, (unsigned int)vn->sz) != (int)vn->sz)
 #else
-      (!(buf = (unsigned char *)malloc((size_t)nv.sz)) ||
-       !ReadFile(fd, buf, (unsigned int)nv.sz, &dummy, NULL) ||
-       dummy != (int)nv.sz)
+      (!(buf = (unsigned char *)malloc((size_t)vn->sz)) ||
+       !ReadFile(fd, buf, (unsigned int)vn->sz, &dummy, NULL) ||
+       dummy != (int)vn->sz)
 #endif
     {
-      (void)free((char *)nv.buf);
+      (void)free((char *)vn->buf);
       if (buf)
 	(void)free((char *)buf);
       (void)free((char *)vn);
       return((struct NV *)0);
     }
     for (p = buf, i = 0L; i < cnt; i++, p += *p*2 + 2)
-      if ((unsigned long) (p - buf) + *p * 2 + 2 < nv.sz)
-	_RkRegisterNV(&nv, p + 2, (int)*p, (int)*(p + 1));
+      if ((unsigned long) (p - buf) + *p * 2 + 2 < vn->sz)
+	_RkRegisterNV(vn, p + 2, (int)*p, (int)*(p + 1));
     (void)free((char *)buf);
   } else {
     (void)free(vn);
     return((struct NV *)0);
   }
-  *vn = nv;
   vn->head.right->left = &vn->head;
   vn->head.left->right = &vn->head;
   return(vn);



Canna-dev メーリングリストの案内
Back to archive index