Index: trunk/Ohana/src/opihi/dvo/elixir.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/elixir.c	(revision 3462)
+++ trunk/Ohana/src/opihi/dvo/elixir.c	(revision 3648)
@@ -62,17 +62,10 @@
 int WriteMsg (char *fifo, char *message) {
 
-  int fd, state, mode;
+  int state, mode;
   FILE *f;
 
   /* check lockfile */
-  fd = setlockfile2 (fifo, 2.0, LCK_XCLD, &state);
-  if (fd == -1) return (0);
-  f = fdopen (fd, "r+");
-  if (f == (FILE *) NULL) {
-    mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-    fchmod (fd, mode);
-    clearlockfile2 (fifo, fd, LCK_XCLD, &state);
-    return (0);
-  }
+  f = fsetlockfile (fifo, 2.0, LCK_XCLD, &state);
+  if (f == NULL) return (0);
 
   /* write message to end of file */
@@ -81,11 +74,8 @@
 
   mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-  fchmod (fd, mode);
+  chmod (fifo, mode);
 
-  clearlockfile2 (fifo, fd, LCK_XCLD, &state);
-  fclose (f);
-
+  fclearlockfile (fifo, f, LCK_XCLD, &state);
   return (1);
-
 }
 
@@ -94,5 +84,5 @@
   int i, nbytes, Nbytes, NBYTES;
   char *buffer;
-  int fd, state, mode;
+  int state, mode;
   FILE *f;
   struct stat filestat;
@@ -108,15 +98,7 @@
 
   /* check lockfile */
-  fd = setlockfile2 (fifo, 2.0, LCK_XCLD, &state);
-  if (fd == -1) {
+  f = fsetlockfile (fifo, 2.0, LCK_XCLD, &state);
+  if (f == NULL) {
     fprintf (stderr, "message locked (%d)\n", state);
-    return (0);
-  }
-  f = fdopen (fd, "r+");
-  if (f == (FILE *) NULL) {
-    fprintf (stderr, "message blocked\n");
-    mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-    fchmod (fd, mode);
-    clearlockfile2 (fifo, fd, LCK_XCLD, &state);
     return (0);
   }
@@ -125,7 +107,6 @@
   if (state == LCK_EMPTY) {
     mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-    fchmod (fd, mode);
-    clearlockfile2 (fifo, fd, LCK_XCLD, &state);
-    fclose (f);
+    chmod (fifo, mode);
+    fclearlockfile (fifo, f, LCK_XCLD, &state);
     return (0);
   }  
@@ -148,7 +129,6 @@
 
   mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
-  fchmod (fd, mode);
-  clearlockfile2 (fifo, fd, LCK_XCLD, &state);
-  fclose (f);
+  chmod (f, mode);
+  fclearlockfile (fifo, f, LCK_XCLD, &state);
 
   if (Nbytes == 0) {
