~james-page/ubuntu/raring/dovecot/autopkgtest

« back to all changes in this revision

Viewing changes to src/lib/istream-seekable.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-06-11 11:11:54 UTC
  • mfrom: (1.15.2) (4.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120611111154-678cwbdj6ktgsv1h
Tags: 1:2.1.7-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/{control,rules}: enable PIE hardening.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + d/control: Added Pre-Depends: dpkg (>= 1.15.6) to dovecot-dbg to support
    xz compression in Ubuntu.
  + d/control: Demote dovecot-common Recommends: to Suggests: to prevent
    install of extra packages on upgrade.
  + d/patches/dovecot-drac.patch: Updated with version for dovecot >= 2.0.0.
  + d/control: Drop B-D on systemd.
* Dropped changes:
  + d/patches/fix-racey-restart.patch: part of 2.1.x, no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2005-2012 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "buffer.h"
5
5
#include "close-keep-errno.h"
6
6
#include "read-full.h"
7
7
#include "write-full.h"
8
 
#include "istream-internal.h"
 
8
#include "istream-private.h"
9
9
#include "istream-concat.h"
10
10
#include "istream-seekable.h"
11
11
 
18
18
 
19
19
        char *temp_path;
20
20
        uoff_t write_peak;
 
21
        uoff_t size;
21
22
 
22
23
        int (*fd_callback)(const char **path_r, void *context);
23
24
        void *context;
140
141
                sstream->cur_input = sstream->input[sstream->cur_idx++];
141
142
                if (sstream->cur_input == NULL) {
142
143
                        /* last one, EOF */
 
144
                        sstream->size = sstream->istream.istream.v_offset;
143
145
                        sstream->istream.istream.eof = TRUE;
144
146
                        return -1;
145
147
                }
302
304
        uoff_t old_offset;
303
305
        ssize_t ret;
304
306
 
 
307
        if (sstream->size != (uoff_t)-1) {
 
308
                /* we've already reached EOF and know the size */
 
309
                stream->statbuf.st_size = sstream->size;
 
310
                return &stream->statbuf;
 
311
        }
 
312
 
305
313
        if (sstream->buffer != NULL) {
306
314
                /* we want to know the full size of the file, so read until
307
315
                   we're finished */
313
321
 
314
322
                if (ret == 0) {
315
323
                        i_panic("i_stream_stat() used for non-blocking "
316
 
                                "seekable stream");
 
324
                                "seekable stream %s offset %"PRIuUOFF_T,
 
325
                                i_stream_get_name(sstream->cur_input),
 
326
                                sstream->cur_input->v_offset);
317
327
                }
318
328
                i_stream_skip(&stream->istream, stream->pos - stream->skip);
319
329
                i_stream_seek(&stream->istream, old_offset);
365
375
        sstream->buffer = buffer_create_dynamic(default_pool, BUF_INITIAL_SIZE);
366
376
        sstream->istream.max_buffer_size = max_buffer_size;
367
377
        sstream->fd = -1;
 
378
        sstream->size = (uoff_t)-1;
368
379
 
369
380
        sstream->input = i_new(struct istream *, count + 1);
370
381
        memcpy(sstream->input, input, sizeof(*input) * count);