iostream-temp.c revision e2ce8d4a6ac5d82a906178148453e7613fab9ba0
/* Copyright (c) 2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "buffer.h"
#include "str.h"
#include "safe-mkstemp.h"
#include "write-full.h"
#include "istream-private.h"
#include "ostream-private.h"
#include "iostream-temp.h"
#include <unistd.h>
struct temp_ostream {
struct ostream_private ostream;
char *temp_path_prefix;
enum iostream_temp_flags flags;
int fd;
bool fd_tried;
};
static void
bool close_parent ATTR_UNUSED)
{
}
{
return -1;
return -1;
}
return -1;
}
return -1;
}
return 0;
}
static ssize_t
{
unsigned int i;
for (i = 0; i < iov_count; i++) {
return -1;
}
}
return bytes;
}
static ssize_t
{
unsigned int i;
for (i = 0; i < iov_count; i++) {
if (o_stream_temp_move_to_fd(tstream) == 0) {
iov_count-i);
}
/* failed to move to temp fd, just keep it in memory */
}
}
return ret;
}
{
do {
}
return ret < 0 ? -1 : 0;
}
{
return 0;
return o_stream_temp_dup_cancel(outstream);
return 0;
}
} else {
return o_stream_temp_dup_cancel(outstream);
}
return ret;
}
{
int ret;
if (ret < 0)
return -1;
}
}
enum iostream_temp_flags flags)
{
struct temp_ostream *tstream;
return output;
}
{
buffer_free(&buf);
}
{
struct temp_ostream *tstream =
int fd;
if (fd == -1)
else {
}
/* return the original failed stream. */
} else {
}
return input;
}