Fixed bug: binary files weren't opened with flag b on NT.
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 17 Feb 1998 10:32:51 +0000 (10:32 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 17 Feb 1998 10:32:51 +0000 (10:32 +0000)
CHANGELOG
bfile/bfile.c
index/extract.c
index/kinput.c

index b0e76dd..86a3076 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,5 @@
+Bug fix: Lock files weren't removed as they should when using NT.
+
 Implemented Z39.50 Sort. Zebra's sort handler uses use attributes to
 specify a "sort register". Refer to the gils sample records which
 refer to index type "s" which is specified as "sort" in the default.idx
 Implemented Z39.50 Sort. Zebra's sort handler uses use attributes to
 specify a "sort register". Refer to the gils sample records which
 refer to index type "s" which is specified as "sort" in the default.idx
index b38ff42..eb59b4a 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: bfile.c,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: bfile.c,v $
- * Revision 1.25  1997-10-27 14:25:38  adam
+ * Revision 1.26  1998-02-17 10:32:52  adam
+ * Fixed bug: binary files weren't opened with flag b on NT.
+ *
+ * Revision 1.25  1997/10/27 14:25:38  adam
  * Fixed memory leaks.
  *
  * Revision 1.24  1997/09/18 08:59:16  adam
  * Fixed memory leaks.
  *
  * Revision 1.24  1997/09/18 08:59:16  adam
@@ -188,7 +191,7 @@ BFile bf_open (BFiles bfs, const char *name, int block_size, int wflag)
         {
             FILE *outf;
 
         {
             FILE *outf;
 
-            outf = open_cache (bfs, "a");
+            outf = open_cache (bfs, "ab");
             if (!outf)
             {
                 logf (LOG_FATAL|LOG_ERRNO, "open %scache",
             if (!outf)
             {
                 logf (LOG_FATAL|LOG_ERRNO, "open %scache",
@@ -233,7 +236,7 @@ int bf_commitExists (BFiles bfs)
 {
     FILE *inf;
 
 {
     FILE *inf;
 
-    inf = open_cache (bfs, "r");
+    inf = open_cache (bfs, "rb");
     if (inf)
     {
         fclose (inf);
     if (inf)
     {
         fclose (inf);
@@ -252,7 +255,7 @@ void bf_commitExec (BFiles bfs)
     int first_time;
 
     assert (bfs->commit_area);
     int first_time;
 
     assert (bfs->commit_area);
-    if (!(inf = open_cache (bfs, "r")))
+    if (!(inf = open_cache (bfs, "rb")))
     {
         logf (LOG_LOG, "No commit file");
         return ;
     {
         logf (LOG_LOG, "No commit file");
         return ;
@@ -286,7 +289,7 @@ void bf_commitClean (BFiles bfs, const char *spec)
         mustDisable = 1;
     }
 
         mustDisable = 1;
     }
 
-    if (!(inf = open_cache (bfs, "r")))
+    if (!(inf = open_cache (bfs, "rb")))
         return ;
     while (fscanf (inf, "%s %d", path, &block_size) == 2)
     {
         return ;
     while (fscanf (inf, "%s %d", path, &block_size) == 2)
     {
index 829bb68..ae8a6c4 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: extract.c,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: extract.c,v $
- * Revision 1.78  1998-02-10 12:03:05  adam
+ * Revision 1.79  1998-02-17 10:32:52  adam
+ * Fixed bug: binary files weren't opened with flag b on NT.
+ *
+ * Revision 1.78  1998/02/10 12:03:05  adam
  * Implemented Sort.
  *
  * Revision 1.77  1998/01/12 15:04:08  adam
  * Implemented Sort.
  *
  * Revision 1.77  1998/01/12 15:04:08  adam
@@ -465,7 +468,7 @@ void key_flush (void)
     qsort (key_buf + ptr_top-ptr_i, ptr_i, sizeof(char*), key_qsort_compare);
     getFnameTmp (out_fname, key_file_no);
 
     qsort (key_buf + ptr_top-ptr_i, ptr_i, sizeof(char*), key_qsort_compare);
     getFnameTmp (out_fname, key_file_no);
 
-    if (!(outf = fopen (out_fname, "w")))
+    if (!(outf = fopen (out_fname, "wb")))
     {
         logf (LOG_FATAL|LOG_ERRNO, "fopen %s", out_fname);
         exit (1);
     {
         logf (LOG_FATAL|LOG_ERRNO, "fopen %s", out_fname);
         exit (1);
@@ -491,7 +494,7 @@ void key_flush (void)
     qsort (key_buf + ptr_top-ptr_i, ptr_i, sizeof(char*), key_x_compare);
     getFnameTmp (out_fname, key_file_no);
 
     qsort (key_buf + ptr_top-ptr_i, ptr_i, sizeof(char*), key_x_compare);
     getFnameTmp (out_fname, key_file_no);
 
-    if (!(outf = fopen (out_fname, "w")))
+    if (!(outf = fopen (out_fname, "wb")))
     {
         logf (LOG_FATAL|LOG_ERRNO, "fopen %s", out_fname);
         exit (1);
     {
         logf (LOG_FATAL|LOG_ERRNO, "fopen %s", out_fname);
         exit (1);
@@ -659,6 +662,7 @@ static void addSortString (RecWord *p, const char *string, int length)
 
 static void addString (RecWord *p, const char *string, int length)
 {
 
 static void addString (RecWord *p, const char *string, int length)
 {
+    assert (length > 0);
     if (zebra_maps_is_sort (p->zebra_maps, p->reg_type))
        addSortString (p, string, length);
     else
     if (zebra_maps_is_sort (p->zebra_maps, p->reg_type))
        addSortString (p, string, length);
     else
index 3ba3463..781ec9a 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: kinput.c,v $
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: kinput.c,v $
- * Revision 1.26  1998-01-29 13:39:13  adam
+ * Revision 1.27  1998-02-17 10:32:52  adam
+ * Fixed bug: binary files weren't opened with flag b on NT.
+ *
+ * Revision 1.26  1998/01/29 13:39:13  adam
  * Compress ISAM is default.
  *
  * Revision 1.25  1997/09/17 12:19:14  adam
  * Compress ISAM is default.
  *
  * Revision 1.25  1997/09/17 12:19:14  adam
@@ -449,6 +452,7 @@ int heap_inpc (struct heap_info *hi)
 
         strcpy (this_name, hci.cur_name);
         logf (LOG_DEBUG, "inserting %s", 1+hci.cur_name);
 
         strcpy (this_name, hci.cur_name);
         logf (LOG_DEBUG, "inserting %s", 1+hci.cur_name);
+       assert (hci.cur_name[1]);
         no_diffs++;
         if ((dict_info = dict_lookup (hi->dict, hci.cur_name)))
         {
         no_diffs++;
         if ((dict_info = dict_lookup (hi->dict, hci.cur_name)))
         {