summaryrefslogtreecommitdiff
path: root/noncore/net/ftplib/ftplib.c
authorerik <erik>2007-01-22 22:56:12 (UTC)
committer erik <erik>2007-01-22 22:56:12 (UTC)
commit9b4871054d01a47b4c546952a0948553413840d6 (patch) (unidiff)
tree4e0248489c2790cf4225a116cfb903b637d4cdf0 /noncore/net/ftplib/ftplib.c
parentf60301bab1f8aa3693089036a3791a01ae6f9db8 (diff)
downloadopie-9b4871054d01a47b4c546952a0948553413840d6.zip
opie-9b4871054d01a47b4c546952a0948553413840d6.tar.gz
opie-9b4871054d01a47b4c546952a0948553413840d6.tar.bz2
Every file in this commit makes a call to a function which returns a value.
Each file also didn't check the return value. This commit changes it so that every single non-checked call in these files is checked.
Diffstat (limited to 'noncore/net/ftplib/ftplib.c') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/ftplib/ftplib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/net/ftplib/ftplib.c b/noncore/net/ftplib/ftplib.c
index 421f855..efcd6f0 100644
--- a/noncore/net/ftplib/ftplib.c
+++ b/noncore/net/ftplib/ftplib.c
@@ -949,25 +949,26 @@ GLOBALDEF int FtpRead(void *buf, int max, netbuf *nData)
949/* 949/*
950 * FtpWrite - write to a data connection 950 * FtpWrite - write to a data connection
951 */ 951 */
952GLOBALDEF int FtpWrite(void *buf, int len, netbuf *nData) 952GLOBALDEF int FtpWrite(void *buf, int len, netbuf *nData)
953{ 953{
954 int i; 954 int i;
955 if (nData->dir != FTPLIB_WRITE) 955 if (nData->dir != FTPLIB_WRITE)
956 return 0; 956 return 0;
957 if (nData->buf) 957 if (nData->buf)
958 i = writeline(buf, len, nData); 958 i = writeline(buf, len, nData);
959 else 959 else
960 { 960 {
961 socket_wait(nData); 961 if (socket_wait(nData) < 0)
962 fprintf(stderr, "FtpWrite: socket_wait failed with %s\n", nData->ctrl->response);
962 i = net_write(nData->handle, buf, len); 963 i = net_write(nData->handle, buf, len);
963 } 964 }
964 if (i == -1) 965 if (i == -1)
965 return 0; 966 return 0;
966 nData->xfered += i; 967 nData->xfered += i;
967 if (nData->idlecb && nData->cbbytes) 968 if (nData->idlecb && nData->cbbytes)
968 { 969 {
969 nData->xfered1 += i; 970 nData->xfered1 += i;
970 if (nData->xfered1 > nData->cbbytes) 971 if (nData->xfered1 > nData->cbbytes)
971 { 972 {
972 nData->idlecb(nData, nData->xfered, nData->idlearg); 973 nData->idlecb(nData, nData->xfered, nData->idlearg);
973 nData->xfered1 = 0; 974 nData->xfered1 = 0;
@@ -1330,17 +1331,20 @@ GLOBALDEF int FtpDelete(const char *fnm, netbuf *nControl)
1330 return 1; 1331 return 1;
1331} 1332}
1332 1333
1333/* 1334/*
1334 * FtpQuit - disconnect from remote 1335 * FtpQuit - disconnect from remote
1335 * 1336 *
1336 * return 1 if successful, 0 otherwise 1337 * return 1 if successful, 0 otherwise
1337 */ 1338 */
1338GLOBALDEF void FtpQuit(netbuf *nControl) 1339GLOBALDEF void FtpQuit(netbuf *nControl)
1339{ 1340{
1340 if (nControl->dir != FTPLIB_CONTROL) 1341 if (nControl->dir != FTPLIB_CONTROL)
1341 return; 1342 return;
1342 FtpSendCmd("QUIT",'2',nControl); 1343 if (FtpSendCmd("QUIT",'2',nControl) == 1) {
1344 if (ftplib_debug > 2)
1345 fprintf(stderr, "FtpQuit: FtpSendCmd(QUIT) failed\n");
1346 }
1343 net_close(nControl->handle); 1347 net_close(nControl->handle);
1344 free(nControl->buf); 1348 free(nControl->buf);
1345 free(nControl); 1349 free(nControl);
1346} 1350}