From 8fbfb7aa2db2b7eb8feeefbeac789721b8509593 Mon Sep 17 00:00:00 2001 From: djm Date: Tue, 16 Mar 2021 06:15:43 +0000 Subject: [PATCH] don't let logging clobber errno before use --- usr.bin/ssh/sftp-server.c | 10 ++++++---- 1 file 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); -- 2.20.1