Module Name:    src
Committed By:   christos
Date:           Mon Nov 11 16:46:21 UTC 2013

Modified Files:
        src/crypto/external/bsd/openssh/dist: sftp-client.c

Log Message:
CID 1128376: check ftruncate result


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/crypto/external/bsd/openssh/dist/sftp-client.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/openssh/dist/sftp-client.c
diff -u src/crypto/external/bsd/openssh/dist/sftp-client.c:1.9 src/crypto/external/bsd/openssh/dist/sftp-client.c:1.10
--- src/crypto/external/bsd/openssh/dist/sftp-client.c:1.9	Mon Nov 11 11:43:26 2013
+++ src/crypto/external/bsd/openssh/dist/sftp-client.c	Mon Nov 11 11:46:20 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: sftp-client.c,v 1.9 2013/11/11 16:43:26 christos Exp $	*/
+/*	$NetBSD: sftp-client.c,v 1.10 2013/11/11 16:46:20 christos Exp $	*/
 /* $OpenBSD: sftp-client.c,v 1.101.2.1 2013/11/08 01:33:56 djm Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <d...@openbsd.org>
@@ -22,7 +22,7 @@
 /* XXX: copy between two remote sites */
 
 #include "includes.h"
-__RCSID("$NetBSD: sftp-client.c,v 1.9 2013/11/11 16:43:26 christos Exp $");
+__RCSID("$NetBSD: sftp-client.c,v 1.10 2013/11/11 16:46:20 christos Exp $");
 #include <sys/types.h>
 #include <sys/poll.h>
 #include <sys/queue.h>
@@ -1212,7 +1212,9 @@ do_download(struct sftp_conn *conn, char
 			    "server reordered requests", local_path);
 		}
 		debug("truncating at %llu", (unsigned long long)highwater);
-		ftruncate(local_fd, highwater);
+		if (ftruncate(local_fd, highwater) == -1) {
+			error("Unable to truncate \"%s\"", local_path);
+		}
 	}
 	if (read_error) {
 		error("Couldn't read from remote file \"%s\" : %s",

Reply via email to