Re: Nulls instead of data

This is a discussion on Re: Nulls instead of data within the Rsync forums, part of the Networking and Network Related category; --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 20, 2005 at 08:...


Go Back   Usenet Forums > Networking and Network Related > Rsync

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-20-2005
Wayne Davison
 
Posts: n/a
Default Re: Nulls instead of data


--0OAP2g/MAC+5xKAE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Sep 20, 2005 at 08:40:41AM -0700, Wayne Davison wrote:
> The attached patch should hopefully fix this for you.


.... if it were actually attached ...

...wayne..

--0OAP2g/MAC+5xKAE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="reading.patch"

--- fileio.c 27 Feb 2005 21:12:13 -0000 1.19
+++ fileio.c 20 Sep 2005 15:36:45 -0000
@@ -22,6 +22,10 @@
*/
#include "rsync.h"

+#ifndef ENODATA
+#define ENODATA EAGAIN
+#endif
+
extern int sparse_files;

static char last_byte;
@@ -217,34 +221,35 @@ char *map_ptr(struct map_struct *map, OF
rprintf(FERROR, "invalid read_size of %ld in map_ptr\n",
(long)read_size);
exit_cleanup(RERR_FILEIO);
- } else {
- if (map->p_fd_offset != read_start) {
- OFF_T ret = do_lseek(map->fd, read_start, SEEK_SET);
- if (ret != read_start) {
- rsyserr(FERROR, errno,
- "lseek returned %.0f, not %.0f",
- (double)ret, (double)read_start);
- exit_cleanup(RERR_FILEIO);
- }
- map->p_fd_offset = read_start;
- }
+ }

- if ((nread=read(map->fd,map->p + read_offset,read_size)) != read_size) {
- if (nread < 0) {
- nread = 0;
- if (!map->status)
- map->status = errno;
- }
- /* the best we can do is zero the buffer - the file
- has changed mid transfer! */
- memset(map->p+read_offset+nread, 0, read_size - nread);
+ if (map->p_fd_offset != read_start) {
+ OFF_T ret = do_lseek(map->fd, read_start, SEEK_SET);
+ if (ret != read_start) {
+ rsyserr(FERROR, errno, "lseek returned %.0f, not %.0f",
+ (double)ret, (double)read_start);
+ exit_cleanup(RERR_FILEIO);
}
- map->p_fd_offset += nread;
+ map->p_fd_offset = read_start;
}
-
+ map->p_fd_offset += read_size;
map->p_offset = window_start;
map->p_len = window_size;

+ while (read_size > 0) {
+ nread = read(map->fd, map->p + read_offset, read_size);
+ if (nread <= 0) {
+ if (!map->status)
+ map->status = nread ? errno : ENODATA;
+ /* The best we can do is zero the buffer -- the file
+ * has changed mid transfer! */
+ memset(map->p + read_offset, 0, read_size);
+ break;
+ }
+ read_offset += nread;
+ read_size -= nread;
+ }
+
return map->p;
}


--0OAP2g/MAC+5xKAE
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

--
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
--0OAP2g/MAC+5xKAE--
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:13 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0