View | Details | Raw Unified | Return to bug 1286 | Differences between
and this patch

Collapse All | Expand All

(-)sletmig2/openssh-4.5p1/sftp-server.c (-4 / +11 lines)
Lines 1295-1301 Link Here
1295
		memset(rset, 0, set_size);
1295
		memset(rset, 0, set_size);
1296
		memset(wset, 0, set_size);
1296
		memset(wset, 0, set_size);
1297
1297
1298
		FD_SET(in, rset);
1298
		/* If the oqueue is close to full then we want to wait on just the output. */
1299
		if (buffer_check_alloc(&oqueue, SFTP_MAX_MSG_LENGTH + 4))
1300
			FD_SET(in, rset);
1301
1299
		olen = buffer_len(&oqueue);
1302
		olen = buffer_len(&oqueue);
1300
		if (olen > 0)
1303
		if (olen > 0)
1301
			FD_SET(out, wset);
1304
			FD_SET(out, wset);
Lines 1308-1314 Link Here
1308
		}
1311
		}
1309
1312
1310
		/* copy stdin to iqueue */
1313
		/* copy stdin to iqueue */
1311
		if (FD_ISSET(in, rset)) {
1314
		if (buffer_check_alloc(&iqueue, SFTP_MAX_MSG_LENGTH + 4) &&
1315
		    FD_ISSET(in, rset)) {
1312
			char buf[4*4096];
1316
			char buf[4*4096];
1313
			len = read(in, buf, sizeof buf);
1317
			len = read(in, buf, sizeof buf);
1314
			if (len == 0) {
1318
			if (len == 0) {
Lines 1331-1337 Link Here
1331
				buffer_consume(&oqueue, len);
1335
				buffer_consume(&oqueue, len);
1332
			}
1336
			}
1333
		}
1337
		}
1334
		/* process requests from client */
1338
		/* process requests from client. If the output buffer
1335
		process();
1339
		 * is critical then don't create more data by
1340
		 * processing more requests. */
1341
		if (buffer_check_alloc(&oqueue, SFTP_MAX_MSG_LENGTH + 4))
1342
			process();
1336
	}
1343
	}
1337
}
1344
}

Return to bug 1286