diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-11-13 20:26:10 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-11-13 20:26:10 +0000 |
commit | 53a337862aa60bbdb96bdf3be33e7096bd6fba4a (patch) | |
tree | ea72e52507dd00709bb8beda16781439d3abae2c | |
parent | 6c799fbe92df8f7dcb874639960e30e99a7a02f3 (diff) |
fseeko() and lseek() have different return values. cope with that correctly. spotted by dhill@mindcry.org
-rw-r--r-- | usr.bin/ftp/ftp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c index 1483adddb3a..359783729f2 100644 --- a/usr.bin/ftp/ftp.c +++ b/usr.bin/ftp/ftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftp.c,v 1.58 2005/10/30 15:17:41 sturm Exp $ */ +/* $OpenBSD: ftp.c,v 1.59 2005/11/13 20:26:09 deraadt Exp $ */ /* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */ /* @@ -60,7 +60,7 @@ */ #if !defined(lint) && !defined(SMALL) -static char rcsid[] = "$OpenBSD: ftp.c,v 1.58 2005/10/30 15:17:41 sturm Exp $"; +static char rcsid[] = "$OpenBSD: ftp.c,v 1.59 2005/11/13 20:26:09 deraadt Exp $"; #endif /* not lint and not SMALL */ #include <sys/types.h> @@ -571,19 +571,19 @@ sendrequest(const char *cmd, const char *local, const char *remote, if (restart_point && (strcmp(cmd, "STOR") == 0 || strcmp(cmd, "APPE") == 0)) { - int rc; + int rc = -1; - rc = -1; switch (curtype) { case TYPE_A: rc = fseeko(fin, restart_point, SEEK_SET); break; case TYPE_I: case TYPE_L: - rc = lseek(fileno(fin), restart_point, SEEK_SET); + if (lseek(fileno(fin), restart_point, SEEK_SET) != -1) + rc = 0; break; } - if (rc < 0) { + if (rc == -1) { warn("local: %s", local); restart_point = 0; progress = oprogress; |