projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
install with -s
[unix-history]
/
usr
/
src
/
usr.bin
/
ftp
/
ftp.c
diff --git
a/usr/src/usr.bin/ftp/ftp.c
b/usr/src/usr.bin/ftp/ftp.c
index
6f3ed61
..
f5b68ee
100644
(file)
--- a/
usr/src/usr.bin/ftp/ftp.c
+++ b/
usr/src/usr.bin/ftp/ftp.c
@@
-1,6
+1,12
@@
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
#ifndef lint
#ifndef lint
-static char sccsid[] = "@(#)ftp.c
4.12
(Berkeley) %G%";
-#endif
+static char sccsid[] = "@(#)ftp.c
5.1
(Berkeley) %G%";
+#endif
not lint
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/stat.h>
@@
-59,7
+65,7
@@
hookup(host, port)
}
hostname = hp->h_name;
hisctladdr.sin_family = hp->h_addrtype;
}
hostname = hp->h_name;
hisctladdr.sin_family = hp->h_addrtype;
- s = socket(hp->h_addrtype, SOCK_STREAM, 0
, 0
);
+ s = socket(hp->h_addrtype, SOCK_STREAM, 0);
if (s < 0) {
perror("ftp: socket");
return (0);
if (s < 0) {
perror("ftp: socket");
return (0);
@@
-242,7
+248,7
@@
sendrequest(cmd, local, remote)
closefunc = fclose;
if (fstat(fileno(fin), &st) < 0 ||
(st.st_mode&S_IFMT) != S_IFREG) {
closefunc = fclose;
if (fstat(fileno(fin), &st) < 0 ||
(st.st_mode&S_IFMT) != S_IFREG) {
- fprintf(stderr, "%s: not a plain file.", local);
+ fprintf(stderr, "%s: not a plain file.
\n
", local);
goto bad;
}
}
goto bad;
}
}
@@
-360,12
+366,13
@@
recvrequest(cmd, local, remote, mode)
if (dir != NULL)
*dir = 0;
if (dir != NULL)
*dir = 0;
- if (access(dir ? dir : ".", 2) < 0) {
+ d = access(dir ? local : ".", 2);
+ if (dir != NULL)
+ *dir = '/';
+ if (d < 0) {
perror(local);
goto bad;
}
perror(local);
goto bad;
}
- if (dir != NULL)
- *dir = '/';
}
if (initconn())
goto bad;
}
if (initconn())
goto bad;
@@
-479,6
+486,7
@@
initconn()
{
register char *p, *a;
int result, len;
{
register char *p, *a;
int result, len;
+ int on = 1;
noport:
data_addr = myctladdr;
noport:
data_addr = myctladdr;
@@
-486,13
+494,13
@@
noport:
data_addr.sin_port = 0; /* let system pick one */
if (data != -1)
(void) close (data);
data_addr.sin_port = 0; /* let system pick one */
if (data != -1)
(void) close (data);
- data = socket(AF_INET, SOCK_STREAM, 0
, 0
);
+ data = socket(AF_INET, SOCK_STREAM, 0);
if (data < 0) {
perror("ftp: socket");
return (1);
}
if (!sendport)
if (data < 0) {
perror("ftp: socket");
return (1);
}
if (!sendport)
- if (setsockopt(data, SOL_SOCKET, SO_REUSEADDR,
0, 0
) < 0) {
+ if (setsockopt(data, SOL_SOCKET, SO_REUSEADDR,
&on, sizeof (on)
) < 0) {
perror("ftp: setsockopt (resuse address)");
goto bad;
}
perror("ftp: setsockopt (resuse address)");
goto bad;
}
@@
-501,7
+509,7
@@
noport:
goto bad;
}
if (options & SO_DEBUG &&
goto bad;
}
if (options & SO_DEBUG &&
- setsockopt(data, SOL_SOCKET, SO_DEBUG,
0, 0
) < 0)
+ setsockopt(data, SOL_SOCKET, SO_DEBUG,
&on, sizeof (on)
) < 0)
perror("ftp: setsockopt (ignored)");
len = sizeof (data_addr);
if (getsockname(data, (char *)&data_addr, &len) < 0) {
perror("ftp: setsockopt (ignored)");
len = sizeof (data_addr);
if (getsockname(data, (char *)&data_addr, &len) < 0) {