Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ftpd fstat returns -1 on error (Maxime Villard)



details:   https://anonhg.NetBSD.org/src/rev/2e4d0dc094e3
branches:  trunk
changeset: 788965:2e4d0dc094e3
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jul 31 19:50:47 2013 +0000

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

diffstat:

 libexec/ftpd/ftpd.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 818038263ae2 -r 2e4d0dc094e3 libexec/ftpd/ftpd.c
--- a/libexec/ftpd/ftpd.c       Wed Jul 31 19:27:51 2013 +0000
+++ b/libexec/ftpd/ftpd.c       Wed Jul 31 19:50:47 2013 +0000
@@ -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 @@
 #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 @@
                (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 @@
                (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;



Home | Main Index | Thread Index | Old Index