IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2005, 6:32:51 PM (21 years ago)
Author:
eugene
Message:

cleaning up setlockfile2/fsetlockfile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/imregister/base/WriteFIFO.c

    r3 r3648  
    11# include "imregister.h"
    2 
    3 static char retchar[] = "\n";
    42
    53int WriteFIFO (char *filename, char *line) {
    64
    75  int state, mode;
    8   int fd;
     6  FILE *f;
    97
    10   fd = setlockfile2 (filename, 20.0, LCK_XCLD, &state);
    11   if (fd == -1) {
    12       fprintf (stderr, "ERROR: can't lock fifo %s\n", filename);
    13       return (FALSE);
     8  f = fsetlockfile (filename, 20.0, LCK_XCLD, &state);
     9  if (f == NULL) {
     10    fprintf (stderr, "ERROR: can't lock fifo %s\n", filename);
     11    return (FALSE);
    1412  }
    1513
    16   lseek (fd, 0, SEEK_END);
    17   write (fd, line, strlen (line));
    18   write (fd, retchar, 1);
     14  fseek (f, 0, SEEK_END);
     15  fprintf (f, "%s\n", line);
    1916
    2017  mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
    21   fchmod (fd, mode);
    22   clearlockfile2 (filename, fd, LCK_XCLD, &state);
     18  chmod (filename, mode);
     19  fclearlockfile (filename, f, LCK_XCLD, &state);
    2320
    2421  return (TRUE);
     22}
    2523
    26 }
Note: See TracChangeset for help on using the changeset viewer.