blob: c346c58ccb7adcc03ffbf7d79868333e033fb751 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/* sync.c
Sync a file to disk, if FSYNC_ON_CLOSE is set. */
#include "uucp.h"
#include "uudefs.h"
#include "sysdep.h"
#include "system.h"
#include <errno.h>
boolean
fsysdep_sync (e, zmsg)
openfile_t e;
const char *zmsg;
{
int o;
#if USE_STDIO
if (fflush (e) == EOF)
{
ulog (LOG_ERROR, "%s: fflush: %s", zmsg, strerror (errno));
return FALSE;
}
#endif
#if USE_STDIO
o = fileno (e);
#else
o = e;
#endif
#if FSYNC_ON_CLOSE
if (fsync (o) < 0)
{
ulog (LOG_ERROR, "%s: fsync: %s", zmsg, strerror (errno));
return FALSE;
}
#endif
return TRUE;
}
|