Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/ftp make -R work the same in ftp:// like it does for...



details:   https://anonhg.NetBSD.org/src/rev/b9b4a5c39aee
branches:  trunk
changeset: 772759:b9b4a5c39aee
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jan 15 03:58:28 2012 +0000

description:
make -R work the same in ftp:// like it does for http:// (i.e. work if
there is no local file).

diffstat:

 usr.bin/ftp/cmds.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (53 lines):

diff -r 04e21f926209 -r b9b4a5c39aee usr.bin/ftp/cmds.c
--- a/usr.bin/ftp/cmds.c        Sun Jan 15 03:11:13 2012 +0000
+++ b/usr.bin/ftp/cmds.c        Sun Jan 15 03:58:28 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmds.c,v 1.132 2011/09/16 15:39:26 joerg Exp $ */
+/*     $NetBSD: cmds.c,v 1.133 2012/01/15 03:58:28 christos Exp $      */
 
 /*-
  * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
 #if 0
 static char sccsid[] = "@(#)cmds.c     8.6 (Berkeley) 10/9/94";
 #else
-__RCSID("$NetBSD: cmds.c,v 1.132 2011/09/16 15:39:26 joerg Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.133 2012/01/15 03:58:28 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -111,6 +111,7 @@
 
 #include <ctype.h>
 #include <err.h>
+#include <errno.h>
 #include <glob.h>
 #include <limits.h>
 #include <netdb.h>
@@ -556,7 +557,7 @@
 reget(int argc, char *argv[])
 {
 
-       (void)getit(argc, argv, 1, "r+");
+       (void)getit(argc, argv, 1, restart_point ? "r+" : "w" );
 }
 
 void
@@ -612,10 +613,14 @@
                ret = stat(locfile, &stbuf);
                if (restartit == 1) {
                        if (ret < 0) {
-                               warn("Can't stat `%s'", locfile);
-                               goto freegetit;
+                               if (errno != ENOENT) {
+                                       warn("Can't stat `%s'", locfile);
+                                       goto freegetit;
+                               }
+                               restart_point = 0;
                        }
-                       restart_point = stbuf.st_size;
+                       else
+                               restart_point = stbuf.st_size;
                } else {
                        if (ret == 0) {
                                time_t mtime;



Home | Main Index | Thread Index | Old Index