Announcement

Collapse
No announcement yet.

Small bug in one of the downloads in the download section.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Small bug in one of the downloads in the download section.

    Today i downloaded FTP.Zip from the downloads section. I was having an error
    and i found out the error is a small bug in this code:

    Code:
       Kill localFile
       If Dir$(localFile) <> "" Then
          buffer = Format$(Err, "000") + " Local File Can't be deleted"
          Function = %False
       Else
          On Error Resume Next
          Open localFile For Binary Lock Read Write As #iFF
          If Err Then
             buffer = Format$(Err, "000") + " Local File Open Error"
             Function = %False
          Else
             '- Open a passive-mode connection to the server.
             hData = get_passive_handle(hSocket, sServer)
             If hData = %INVALID_SOCKET Then
                buffer = Format$(gLastErr, "000") + " " + gLastMsg
                Function = %False
             Else
             .
             .
             .
             .
    In the above code, if the file doesnt exists triggers an error 53 in the KILL command. Then the following code "thinks" the file couldnt be opened:

    Code:
          On Error Resume Next
          Open localFile For Binary Lock Read Write As #iFF
          If Err Then
    End exits without downloading the file, and leaves the file open, making impossible to kill the empy (0 byte file) until the app is closed.

    The fix, is to either check the existence of the file before casting the KILL command or putting an ERRCLEAR command after the kill command.

    I thought you (steve or bob) would like to update this file. And im posting this here in case someone has this problem with the FTP.ZIP

    This code is in the module "ftpGetFile" in the "pb_ftp.bas" file.

    Last edited by Elias Montoya; 6 Dec 2007, 01:13 AM.
Working...
X