summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2001-04-06 11:34:03 +0000
committerBruce Evans <bde@FreeBSD.org>2001-04-06 11:34:03 +0000
commit9481d9d5f0af939304af5659366eca171686f3e3 (patch)
treebab1ab0afbc00853c4d52cf1b01ccff8b89de067 /usr.bin
parentd93cd1f5ff6c1b53dd6f0869c540f5bad0c0c201 (diff)
downloadsrc-test2-9481d9d5f0af939304af5659366eca171686f3e3.tar.gz
src-test2-9481d9d5f0af939304af5659366eca171686f3e3.zip
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ftp/util.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c
index 0cb2e59ad02b..a9524dbe8573 100644
--- a/usr.bin/ftp/util.c
+++ b/usr.bin/ftp/util.c
@@ -512,6 +512,7 @@ remotemodtime(file, noisy)
if (debug == 0)
verbose = -1;
if (command("MDTM %s", file) == COMPLETE) {
+ memset(&timebuf, 0, sizeof(timebuf));
/*
* Parse the time string, which is expected to be 14
* characters long. Some broken servers send tm_year
@@ -529,8 +530,7 @@ remotemodtime(file, noisy)
y2kbug = 1;
} else if (len == 14)
fmt = "%04d%02d%02d%02d%02d%02d";
- if (fmt != NULL)
- memset(&timebuf, 0, sizeof(timebuf));
+ if (fmt != NULL) {
if (sscanf(mtbuf, fmt, &year, &month,
&timebuf.tm_mday, &timebuf.tm_hour,
&timebuf.tm_min, &timebuf.tm_sec) == 6) {
@@ -542,10 +542,12 @@ remotemodtime(file, noisy)
timebuf.tm_year = year - 1900;
rtime = mktime(&timebuf);
}
+ }
}
- if (rtime == -1 && (noisy || debug != 0))
- printf("Can't convert %s to a time.\n", mtbuf);
- else
+ if (rtime == -1) {
+ if (noisy || debug != 0)
+ printf("Can't convert %s to a time.\n", mtbuf);
+ } else
rtime += timebuf.tm_gmtoff; /* conv. local -> GMT */
} else if (noisy && debug == 0)
puts(reply_string);