summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/sftp-server.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2021-03-16 06:15:44 +0000
committerDamien Miller <djm@cvs.openbsd.org>2021-03-16 06:15:44 +0000
commit5fd1104a90c6098185749b70544f2216e7088680 (patch)
treec1516039b466cd9e1fe18ae101db273af578f8c0 /usr.bin/ssh/sftp-server.c
parentb2789b815c49329dfd163157ff3eed7c6b17d9bf (diff)
don't let logging clobber errno before use
Diffstat (limited to 'usr.bin/ssh/sftp-server.c')
-rw-r--r--usr.bin/ssh/sftp-server.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/ssh/sftp-server.c b/usr.bin/ssh/sftp-server.c
index 18869639d24..da053cd7567 100644
--- a/usr.bin/ssh/sftp-server.c
+++ b/usr.bin/ssh/sftp-server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-server.c,v 1.122 2021/02/18 00:30:17 djm Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.123 2021/03/16 06:15:43 djm Exp $ */
/*
* Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
*
@@ -799,15 +799,17 @@ process_write(u_int32_t id)
status = SSH2_FX_FAILURE;
else {
if (!(handle_to_flags(handle) & O_APPEND) &&
- lseek(fd, off, SEEK_SET) == -1) {
+ lseek(fd, off, SEEK_SET) == -1) {
status = errno_to_portable(errno);
- error_f("seek failed");
+ error_f("seek \"%.100s\": %s", handle_to_name(handle),
+ strerror(errno));
} else {
/* XXX ATOMICIO ? */
ret = write(fd, data, len);
if (ret == -1) {
- error_f("write: %s", strerror(errno));
status = errno_to_portable(errno);
+ error_f("write \"%.100s\": %s",
+ handle_to_name(handle), strerror(errno));
} else if ((size_t)ret == len) {
status = SSH2_FX_OK;
handle_update_write(handle, ret);