summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2004-11-15 12:41:56 +0000
committeryar <yar@FreeBSD.org>2004-11-15 12:41:56 +0000
commit93c067539e36ace08d44d61b64b7fd833dcae188 (patch)
treeb0c0cb0739e27722ea0864dfc96db960c84f82e4 /libexec
parentc174c57d9d244a5eab7ccbb84ae730653d1ff5a1 (diff)
downloadFreeBSD-src-93c067539e36ace08d44d61b64b7fd833dcae188.zip
FreeBSD-src-93c067539e36ace08d44d61b64b7fd833dcae188.tar.gz
RFC 959 states that the following codes should be used
for status replies on file system objects: 212 Directory status. 213 File status. Reported by: Oleg Koreshkov <okor -at- zone.salut.ru> MFC after: 1 week
Diffstat (limited to 'libexec')
-rw-r--r--libexec/ftpd/ftpd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 8705dc8..4679626 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -2235,12 +2235,14 @@ statfilecmd(char *filename)
{
FILE *fin;
int atstart;
- int c;
+ int c, code;
char line[LINE_MAX];
+ struct stat st;
+ code = lstat(filename, &st) == 0 && S_ISDIR(st.st_mode) ? 212 : 213;
(void)snprintf(line, sizeof(line), _PATH_LS " -lgA %s", filename);
fin = ftpd_popen(line, "r");
- lreply(211, "status of %s:", filename);
+ lreply(code, "status of %s:", filename);
atstart = 1;
while ((c = getc(fin)) != EOF) {
if (c == '\n') {
@@ -2269,7 +2271,7 @@ statfilecmd(char *filename)
atstart = (c == '\n');
}
(void) ftpd_pclose(fin);
- reply(211, "End of Status");
+ reply(code, "End of Status");
}
void
OpenPOWER on IntegriCloud