Contents of /trunk/netkit-rsh/patches/netkit-rsh-0.17-errno.patch
Parent Directory | Revision Log
Revision 153 -
(show annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 1301 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 1301 byte(s)
-import
1 | --- netkit-rsh-0.17/rcp/rcp.c.errno 2004-11-17 13:49:13.247815440 +0100 |
2 | +++ netkit-rsh-0.17/rcp/rcp.c 2004-11-17 13:52:56.638854840 +0100 |
3 | @@ -613,6 +613,7 @@ |
4 | struct stat stb; |
5 | struct timeval tv[2]; |
6 | enum { YES, NO, DISPLAYED } wrerr; |
7 | + int werrno = 0; |
8 | BUF *bp; |
9 | off_t i, j, size; |
10 | char ch, *targ; |
11 | @@ -766,6 +767,7 @@ |
12 | cp = bp->buf; |
13 | count = 0; |
14 | wrerr = NO; |
15 | + werrno = 0; |
16 | for (i = 0; i < size; i += BUFSIZ) { |
17 | amt = BUFSIZ; |
18 | if (i + amt > size) |
19 | @@ -784,16 +786,20 @@ |
20 | } while (amt > 0); |
21 | if (count == bp->cnt) { |
22 | if (wrerr == NO && |
23 | - write(ofd, bp->buf, count) != count) |
24 | + write(ofd, bp->buf, count) != count) { |
25 | wrerr = YES; |
26 | + werrno = errno; |
27 | + } |
28 | count = 0; |
29 | cp = bp->buf; |
30 | } |
31 | } |
32 | if (count != 0 && wrerr == NO && |
33 | - write(ofd, bp->buf, count) != count) |
34 | + write(ofd, bp->buf, count) != count) { |
35 | wrerr = YES; |
36 | - if (ftruncate(ofd, size)) { |
37 | + werrno = errno; |
38 | + } |
39 | + if (wrerr == NO && ftruncate(ofd, size)) { |
40 | error("rcp: can't truncate %s: %s\n", np, |
41 | strerror(errno)); |
42 | wrerr = DISPLAYED; |
43 | @@ -810,7 +816,7 @@ |
44 | } |
45 | switch(wrerr) { |
46 | case YES: |
47 | - error("rcp: %s: %s\n", np, strerror(errno)); |
48 | + error("rcp: %s: %s\n", np, strerror(werrno)); |
49 | break; |
50 | case NO: |
51 | (void)write(rem, "", 1); |