istream-file.c revision 334fcad698ed0fd1319c5350eb3f7bcf9da242bf
/* Copyright (c) 2002-2010 Dovecot authors, see the included COPYING file */
/* @UNSAFE: whole file */
#include "lib.h"
#include "ioloop.h"
#include "istream-internal.h"
#include "network.h"
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
struct file_istream {
struct istream_private istream;
unsigned int file:1;
unsigned int autoclose_fd:1;
unsigned int seen_eof:1;
};
{
i_error("file_istream.close(%s) failed: %m",
}
}
}
{
return -1;
}
return 0;
}
{
return -2;
if (i_stream_file_open(stream) < 0)
return -1;
}
do {
/* don't try to read() again. EOF from keyboard (^D)
requires this to work right. */
ret = 0;
} else {
size);
}
if (ret == 0) {
/* EOF */
return -1;
}
ret = 0;
} else {
return -1;
}
}
ret = 0;
} else {
}
}
return ret;
}
bool mark ATTR_UNUSED)
{
i_panic("stream doesn't support seeking backwards");
}
}
{
/* can't do anything or data would be lost */
return;
}
}
static const struct stat *
{
/* return defaults */
return NULL;
}
} else {
return NULL;
}
}
}
static struct istream *
{
struct file_istream *fstream;
bool is_file;
/* if it's a file, set the flags properly */
if (fd == -1)
else {
/* we're trying to open a directory.
we're not designed for it. */
}
if (is_file) {
}
}
bool autoclose_fd)
{
}
{
return input;
}