summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-08-13 21:19:37 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-08-13 21:19:37 +1000
commitfe6649da0cd211efc069aa9987b00838d030ef1d (patch)
tree88a21d6391c047fbf32ed9c50b9a7594978e0599
parentc7a6fc41bfdcd73469b153437a8e75e0b1057894 (diff)
downloadopenssh-git-fe6649da0cd211efc069aa9987b00838d030ef1d.tar.gz
- avsm@cvs.openbsd.org 2004/08/11 21:44:32
[authfd.c scp.c ssh-keyscan.c] use atomicio instead of homegrown equivalents or read/write. markus@ ok
-rw-r--r--ChangeLog6
-rw-r--r--authfd.c19
-rw-r--r--scp.c9
-rw-r--r--ssh-keyscan.c6
4 files changed, 16 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c5722e4..e0590dcc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
- avsm@cvs.openbsd.org 2004/08/11 21:43:05
[channels.c channels.h clientloop.c misc.c misc.h serverloop.c ssh-agent.c]
some signed/unsigned int comparison cleanups; markus@ ok
+ - avsm@cvs.openbsd.org 2004/08/11 21:44:32
+ [authfd.c scp.c ssh-keyscan.c]
+ use atomicio instead of homegrown equivalents or read/write.
+ markus@ ok
20040812
- (dtucker) [sshd.c] Remove duplicate variable imported during sync.
@@ -1602,4 +1606,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
-$Id: ChangeLog,v 1.3499 2004/08/13 11:18:00 dtucker Exp $
+$Id: ChangeLog,v 1.3500 2004/08/13 11:19:37 dtucker Exp $
diff --git a/authfd.c b/authfd.c
index 42ca0825..662350ce 100644
--- a/authfd.c
+++ b/authfd.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: authfd.c,v 1.63 2003/11/21 11:57:03 djm Exp $");
+RCSID("$OpenBSD: authfd.c,v 1.64 2004/08/11 21:44:31 avsm Exp $");
#include <openssl/evp.h>
@@ -133,16 +133,9 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply
* Wait for response from the agent. First read the length of the
* response packet.
*/
- len = 4;
- while (len > 0) {
- l = read(auth->fd, buf + 4 - len, len);
- if (l == -1 && (errno == EAGAIN || errno == EINTR))
- continue;
- if (l <= 0) {
- error("Error reading response length from authentication socket.");
- return 0;
- }
- len -= l;
+ if (atomicio(read, auth->fd, buf, 4) != 4) {
+ error("Error reading response length from authentication socket.");
+ return 0;
}
/* Extract the length, and check it for sanity. */
@@ -156,9 +149,7 @@ ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply
l = len;
if (l > sizeof(buf))
l = sizeof(buf);
- l = read(auth->fd, buf, l);
- if (l == -1 && (errno == EAGAIN || errno == EINTR))
- continue;
+ l = atomicio(read, auth->fd, buf, l);
if (l <= 0) {
error("Error reading response from authentication socket.");
return 0;
diff --git a/scp.c b/scp.c
index 33c5891f..ef9eaa1a 100644
--- a/scp.c
+++ b/scp.c
@@ -71,7 +71,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: scp.c,v 1.116 2004/07/08 12:47:21 dtucker Exp $");
+RCSID("$OpenBSD: scp.c,v 1.117 2004/08/11 21:44:32 avsm Exp $");
#include "xmalloc.h"
#include "atomicio.h"
@@ -898,11 +898,8 @@ bad: run_err("%s: %s", np, strerror(errno));
amt = size - i;
count += amt;
do {
- j = read(remin, cp, amt);
- if (j == -1 && (errno == EINTR ||
- errno == EAGAIN)) {
- continue;
- } else if (j <= 0) {
+ j = atomicio(read, remin, cp, amt);
+ if (j <= 0) {
run_err("%s", j ? strerror(errno) :
"dropped connection");
exit(1);
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index fd3185ad..3cb52ac2 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -7,7 +7,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keyscan.c,v 1.49 2004/06/14 01:44:39 djm Exp $");
+RCSID("$OpenBSD: ssh-keyscan.c,v 1.50 2004/08/11 21:44:32 avsm Exp $");
#include "openbsd-compat/sys-queue.h"
@@ -494,7 +494,7 @@ congreet(int s)
bufsiz = sizeof(buf);
cp = buf;
- while (bufsiz-- && (n = read(s, cp, 1)) == 1 && *cp != '\n') {
+ while (bufsiz-- && (n = atomicio(read, s, cp, 1)) == 1 && *cp != '\n') {
if (*cp == '\r')
*cp = '\n';
cp++;
@@ -560,7 +560,7 @@ conread(int s)
congreet(s);
return;
}
- n = read(s, c->c_data + c->c_off, c->c_len - c->c_off);
+ n = atomicio(read, s, c->c_data + c->c_off, c->c_len - c->c_off);
if (n < 0) {
error("read (%s): %s", c->c_name, strerror(errno));
confree(s);