Skip to content

Instantly share code, notes, and snippets.

@bulletmark
Created March 28, 2011 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bulletmark/891406 to your computer and use it in GitHub Desktop.
Save bulletmark/891406 to your computer and use it in GitHub Desktop.
Makes ftpd-topfield clean up closed socket correctly, even when lost ungracefully from vlc >v0.9.
diff --git a/ftpd-topfield/ftpd.c b/ftpd-topfield/ftpd.c
index db0b67b..f6d3458 100644
--- a/ftpd-topfield/ftpd.c
+++ b/ftpd-topfield/ftpd.c
@@ -932,6 +932,7 @@ reboot_topfield (void)
void
retrieve (const char *cmd, const char *name)
{
+ static int in_get;
FILE *dout = 0;
off_t current = restart_point;
tf_dirent dirent;
@@ -940,7 +941,6 @@ retrieve (const char *cmd, const char *name)
int retries = 0;
size_t skip = 0;
int aborted = 0;
- int in_get = 0;
int replied = 0;
int eof;
@@ -949,6 +949,7 @@ retrieve (const char *cmd, const char *name)
int turbo = is_turbo(userpath);
+ in_get = 0;
aborted = setjmp(abort_buf);
abort_buf_valid = 1;
transflag = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment