~ubuntu-branches/ubuntu/lucid/rsync/lucid

« back to all changes in this revision

Viewing changes to io.c

  • Committer: Bazaar Package Importer
  • Author(s): Paul Slootman
  • Date: 2009-06-17 13:43:12 UTC
  • mfrom: (1.2.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20090617134312-aopuowraetuj41s8
Tags: 3.0.6-1
* new upstream release.
* Manpage now states that MD5 is used for protocol version 30 and higher.
  closes:#520330
* Updated to standards version 3.8.2. Added debian/README.source .
* Added lintian override for embedded-zlib, as this is a modified version
  optimized for the rsync protocol. I.e. the standard zlib version will not
  work as well.
* Added a 'status' option to the init.d script.
  closes:#492138
* Manpage now declares --delete-during to be the default in the summary.
  closes:#472767,#476368

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 * Copyright (C) 1996-2001 Andrew Tridgell
5
5
 * Copyright (C) 1996 Paul Mackerras
6
6
 * Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
7
 
 * Copyright (C) 2003-2008 Wayne Davison
 
7
 * Copyright (C) 2003-2009 Wayne Davison
8
8
 *
9
9
 * This program is free software; you can redistribute it and/or modify
10
10
 * it under the terms of the GNU General Public License as published by
1418
1418
        total_written = (sleep_usec - elapsed_usec) * bwlimit / (ONE_SEC/1024);
1419
1419
}
1420
1420
 
 
1421
static const char *what_fd_is(int fd)
 
1422
{
 
1423
        static char buf[20];
 
1424
 
 
1425
        if (fd == sock_f_out)
 
1426
                return "socket";
 
1427
        else if (fd == msg_fd_out)
 
1428
                return "message fd";
 
1429
        else if (fd == batch_fd)
 
1430
                return "batch file";
 
1431
        else {
 
1432
                snprintf(buf, sizeof buf, "fd %d", fd);
 
1433
                return buf;
 
1434
        }
 
1435
}
 
1436
 
1421
1437
/* Write len bytes to the file descriptor fd, looping as necessary to get
1422
1438
 * the job done and also (in certain circumstances) reading any data on
1423
1439
 * msg_fd_in to avoid deadlock.
1496
1512
                        if (am_server && fd == msg_fd_out)
1497
1513
                                exit_cleanup(RERR_STREAMIO);
1498
1514
                        rsyserr(FERROR, errno,
1499
 
                                "writefd_unbuffered failed to write %ld bytes [%s]",
1500
 
                                (long)len, who_am_i());
 
1515
                                "writefd_unbuffered failed to write %ld bytes to %s [%s]",
 
1516
                                (long)len, what_fd_is(fd), who_am_i());
1501
1517
                        /* If the other side is sending us error messages, try
1502
1518
                         * to grab any messages they sent before they died. */
1503
1519
                        while (!am_server && fd == sock_f_out && io_multiplexing_in) {
1555
1571
        if (fd == sock_f_out)
1556
1572
                stats.total_written += len;
1557
1573
 
1558
 
        if (fd == write_batch_monitor_out) {
1559
 
                if ((size_t)write(batch_fd, buf, len) != len)
1560
 
                        exit_cleanup(RERR_FILEIO);
1561
 
        }
 
1574
        if (fd == write_batch_monitor_out)
 
1575
                writefd_unbuffered(batch_fd, buf, len);
1562
1576
 
1563
1577
        if (!iobuf_out || fd != iobuf_f_out) {
1564
1578
                writefd_unbuffered(fd, buf, len);