summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-05-02 18:21:49 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-05-02 18:21:49 +0000
commit72bd52341addafb43a5ee95ef2474e632f888389 (patch)
treed621cb215e2bee6fc1831cd5a33dd1b87ec6e52a
parent16c82df238e276641551368e6c48c280ca3f7790 (diff)
more atomicio
-rw-r--r--usr.bin/ssh/scp.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c
index e7c358646c4..491a78907fc 100644
--- a/usr.bin/ssh/scp.c
+++ b/usr.bin/ssh/scp.c
@@ -45,7 +45,7 @@
*/
#include "includes.h"
-RCSID("$Id: scp.c,v 1.29 2000/05/01 07:05:08 deraadt Exp $");
+RCSID("$Id: scp.c,v 1.30 2000/05/02 18:21:48 deraadt Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -573,7 +573,7 @@ next: (void) close(fd);
if (i + amt > stb.st_size)
amt = stb.st_size - i;
if (!haderr) {
- result = read(fd, bp->buf, amt);
+ result = atomicio(read, fd, bp->buf, amt);
if (result != amt)
haderr = result >= 0 ? EIO : errno;
}
@@ -692,12 +692,12 @@ sink(argc, argv)
targisdir = 1;
for (first = 1;; first = 0) {
cp = buf;
- if (read(remin, cp, 1) <= 0)
+ if (atomicio(read, remin, cp, 1) <= 0)
return;
if (*cp++ == '\n')
SCREWUP("unexpected <newline>");
do {
- if (read(remin, &ch, sizeof(ch)) != sizeof(ch))
+ if (atomicio(read, remin, &ch, sizeof(ch)) != sizeof(ch))
SCREWUP("lost connection");
*cp++ = ch;
} while (cp < &buf[sizeof(buf) - 1] && ch != '\n');
@@ -835,7 +835,7 @@ bad: run_err("%s: %s", np, strerror(errno));
amt = size - i;
count += amt;
do {
- j = read(remin, cp, amt);
+ j = atomicio(read, remin, cp, amt);
if (j <= 0) {
run_err("%s", j ? strerror(errno) :
"dropped connection");
@@ -848,7 +848,7 @@ bad: run_err("%s: %s", np, strerror(errno));
if (count == bp->cnt) {
/* Keep reading so we stay sync'd up. */
if (wrerr == NO) {
- j = write(ofd, bp->buf, count);
+ j = atomicio(write, ofd, bp->buf, count);
if (j != count) {
wrerr = YES;
wrerrno = j >= 0 ? EIO : errno;
@@ -861,7 +861,7 @@ bad: run_err("%s: %s", np, strerror(errno));
if (showprogress)
progressmeter(1);
if (count != 0 && wrerr == NO &&
- (j = write(ofd, bp->buf, count)) != count) {
+ (j = atomicio(write, ofd, bp->buf, count)) != count) {
wrerr = YES;
wrerrno = j >= 0 ? EIO : errno;
}
@@ -913,7 +913,7 @@ response()
{
char ch, *cp, resp, rbuf[2048];
- if (read(remin, &resp, sizeof(resp)) != sizeof(resp))
+ if (atomicio(read, remin, &resp, sizeof(resp)) != sizeof(resp))
lostconn(0);
cp = rbuf;
@@ -926,7 +926,7 @@ response()
case 1: /* error, followed by error msg */
case 2: /* fatal error, "" */
do {
- if (read(remin, &ch, sizeof(ch)) != sizeof(ch))
+ if (atomicio(read, remin, &ch, sizeof(ch)) != sizeof(ch))
lostconn(0);
*cp++ = ch;
} while (cp < &rbuf[sizeof(rbuf) - 1] && ch != '\n');
@@ -1006,7 +1006,7 @@ run_err(const char *fmt,...)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scp.c,v 1.29 2000/05/01 07:05:08 deraadt Exp $
+ * $Id: scp.c,v 1.30 2000/05/02 18:21:48 deraadt Exp $
*/
char *