Fixed locking for metafiles.
[idzebra-moved-to-github.git] / bfile / mfile.c
index 684d6b0..6afd611 100644 (file)
@@ -4,7 +4,14 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: mfile.c,v $
- * Revision 1.37  2000-03-15 15:00:30  adam
+ * Revision 1.39  2000-05-05 13:48:03  adam
+ * Fixed locking for metafiles.
+ *
+ * Revision 1.38  2000/03/20 19:08:35  adam
+ * Added remote record import using Z39.50 extended services and Segment
+ * Requests.
+ *
+ * Revision 1.37  2000/03/15 15:00:30  adam
  * First work on threaded version.
  *
  * Revision 1.36  1999/12/08 15:03:11  adam
@@ -320,6 +327,7 @@ MFile_area mf_init(const char *name, const char *spec)
            if (!meta_f)
            {
                meta_f = (meta_file *) xmalloc(sizeof(*meta_f));
+               zebra_mutex_init (&meta_f->mutex);
                meta_f->ma = ma;
                meta_f->next = ma->mfiles;
                meta_f->open = 0;
@@ -527,7 +535,10 @@ int mf_read(MFile mf, int no, int offset, int nbytes, void *buf)
     if ((rd = file_position(mf, no, offset)) < 0)
     {
         if (rd == -2)
+       {
+           zebra_mutex_unlock (&mf->mutex);
             return 0;
+       }
         else
             exit(1);
     }