Module Name:    src
Committed By:   christos
Date:           Wed Jul 31 19:50:47 UTC 2013

Modified Files:
        src/libexec/ftpd: ftpd.c

Log Message:
fstat returns -1 on error (Maxime Villard)
also while (1) -> for (;;)


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/libexec/ftpd/ftpd.c

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

Modified files:

Index: src/libexec/ftpd/ftpd.c
diff -u src/libexec/ftpd/ftpd.c:1.199 src/libexec/ftpd/ftpd.c:1.200
--- src/libexec/ftpd/ftpd.c:1.199	Wed Jul  3 10:16:01 2013
+++ src/libexec/ftpd/ftpd.c	Wed Jul 31 15:50:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ftpd.c,v 1.199 2013/07/03 14:16:01 christos Exp $	*/
+/*	$NetBSD: ftpd.c,v 1.200 2013/07/31 19:50:47 christos Exp $	*/
 
 /*
  * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 19
 #if 0
 static char sccsid[] = "@(#)ftpd.c	8.5 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: ftpd.c,v 1.199 2013/07/03 14:16:01 christos Exp $");
+__RCSID("$NetBSD: ftpd.c,v 1.200 2013/07/31 19:50:47 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -2149,7 +2149,7 @@ send_data_with_read(int filefd, int netf
 		(void)gettimeofday(&then, NULL);
 	} else
 		bufrem = readsize;
-	while (1) {
+	for (;;) {
 		(void) alarm(curclass.timeout);
 		c = read(filefd, buf, readsize);
 		if (c == 0)
@@ -2392,7 +2392,7 @@ receive_data(FILE *instr, FILE *outstr)
 		(void) alarm(curclass.timeout);
 		if (curclass.readsize)
 			readsize = curclass.readsize;
-		else if (fstat(filefd, &st))
+		else if (fstat(filefd, &st) != -1)
 			readsize = (ssize_t)st.st_blksize;
 		else
 			readsize = BUFSIZ;

Reply via email to