return buf;
}
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
static void _ps_files_open(ps_files *data, const char *key)
{
char buf[MAXPATHLEN];
data->lastkey = estrdup(key);
#ifdef O_EXCL
- data->fd = V_OPEN((buf, O_RDWR));
+ data->fd = V_OPEN((buf, O_RDWR | O_BINARY));
if (data->fd == -1) {
if (errno == ENOENT) {
- data->fd = V_OPEN((buf, O_EXCL | O_RDWR | O_CREAT, 0600));
+ data->fd = V_OPEN((buf, O_EXCL | O_RDWR | O_CREAT | O_BINARY, 0600));
}
} else {
flock(data->fd, LOCK_EX);
}
#else
- data->fd = V_OPEN((buf, O_CREAT | O_RDWR, 0600));
+ data->fd = V_OPEN((buf, O_CREAT | O_RDWR | O_BINARY, 0600));
if (data->fd != -1)
flock(data->fd, LOCK_EX);
#endif