]> git.pld-linux.org Git - packages/poldek.git/commitdiff
- it always seeks forward it seems (here by 3 bytes); try to make it a little faster...
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Thu, 21 Apr 2005 20:51:23 +0000 (20:51 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    poldek-cookie.patch -> 1.5

poldek-cookie.patch

index bfd7548af4d81d3f557b7f01913c7d72ea00d4ff..b01b3c1a4373d6a973049312670b0fbd5ed5ace4 100644 (file)
@@ -41,8 +41,50 @@ diff -urN poldek-0.18.8.org/pkgfl.c poldek-0.18.8/pkgfl.c
  
 diff -urN poldek-0.18.8.org/pkgu.c poldek-0.18.8/pkgu.c
 --- poldek-0.18.8.org/pkgu.c   2002-05-15 17:42:48.000000000 +0200
-+++ poldek-0.18.8/pkgu.c       2005-04-21 22:04:22.641456960 +0200
-@@ -239,8 +239,8 @@
++++ poldek-0.18.8/pkgu.c       2005-04-21 22:47:36.188177928 +0200
+@@ -180,11 +180,36 @@
+     void *rawhdr;
+     Header hdr;
+-    if (offset > 0)
+-        if (fseek(stream, offset, SEEK_SET) != 0) {
+-            logn(LOGERR, "pkguinf_restore: fseek %ld: %m", offset);
+-            return NULL;
+-        }
++    if (offset > 0) {
++      long currseek = ftell(stream);
++      char *buf = NULL;
++      if (currseek == -1) {
++          logn(LOGERR, "pkguinf_restore: ftell %ld: %m", currseek);
++          return NULL;
++      }
++      if (seek >= currseek) {
++          currseek = seek - currseek;
++          if (currseek) {
++              buf = malloc(currseek);
++              if (!buf) {
++                  logn(LOGERR, "pkguinf_restore: malloc: %m");
++                  return NULL;
++              }
++              if (fread(buf, 1, currseek, stream) != currseek) {
++                  logn(LOGERR, "pkguinf_restore: fread error currseek: at %ld %p",
++                         ftell(stream), stream);
++                  return NULL;
++              }
++              free(buf);
++          }
++      } else {
++
++          if (fseek(stream, offset, SEEK_SET) != 0) {
++              logn(LOGERR, "pkguinf_restore: fseek %ld: %m", offset);
++              return NULL;
++          }
++      }
++    }
+     
+     if (fread(&nlangs, sizeof(nlangs), 1, stream) != 1) {
+         logn(LOGERR, "pkguinf_restore: read error nlangs (%m) at %ld %p",
+@@ -239,8 +264,8 @@
  {
      uint16_t nsize, nlangs;
  
This page took 0.471817 seconds and 4 git commands to generate.