comparison src/lib/ostream-file.c @ 9170:b1a27ed69e60 HEAD

Added struct istream.readable_fd, which is used to determine if sendfile() can be used.
author Timo Sirainen <tss@iki.fi>
date Sat, 27 Jun 2009 20:53:35 -0400
parents 3442cd45b502
children 00cd9aacd03c
comparison
equal deleted inserted replaced
9169:389148f79d49 9170:b1a27ed69e60
781 struct file_ostream *foutstream = (struct file_ostream *)outstream; 781 struct file_ostream *foutstream = (struct file_ostream *)outstream;
782 const struct stat *st; 782 const struct stat *st;
783 off_t ret; 783 off_t ret;
784 int in_fd; 784 int in_fd;
785 785
786 in_fd = i_stream_get_fd(instream); 786 in_fd = !instream->readable_fd ? -1 : i_stream_get_fd(instream);
787 787
788 if (in_fd == foutstream->fd) { 788 if (in_fd == foutstream->fd) {
789 /* copying data within same fd. we'll have to be careful with 789 /* copying data within same fd. we'll have to be careful with
790 seeks and overlapping writes. */ 790 seeks and overlapping writes. */
791 st = i_stream_stat(instream, TRUE); 791 st = i_stream_stat(instream, TRUE);