summaryrefslogtreecommitdiff
path: root/src/irc/irc-dcc.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-09-20 16:14:04 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-09-20 16:14:04 +0000
commit25bbe3d28492ce4204857ee45b65da10eda9a041 (patch)
treec118f97e5597d8862b7498a63aea670320f26072 /src/irc/irc-dcc.c
parent9c7d05f605412ecad9aa7eff46e4dbec4f9e03c1 (diff)
downloadweechat-25bbe3d28492ce4204857ee45b65da10eda9a041.zip
Fixed DCC bug: delete failed file only if really empty (on disk)
Diffstat (limited to 'src/irc/irc-dcc.c')
-rw-r--r--src/irc/irc-dcc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/irc/irc-dcc.c b/src/irc/irc-dcc.c
index 443b97c22..630b39440 100644
--- a/src/irc/irc-dcc.c
+++ b/src/irc/irc-dcc.c
@@ -334,6 +334,7 @@ void
dcc_close (t_irc_dcc *ptr_dcc, int status)
{
t_gui_buffer *ptr_buffer;
+ struct stat st;
ptr_dcc->status = status;
@@ -395,7 +396,14 @@ dcc_close (t_irc_dcc *ptr_dcc, int status)
&& DCC_IS_RECV(ptr_dcc->type)
&& ptr_dcc->local_filename
&& ptr_dcc->pos == 0)
- unlink (ptr_dcc->local_filename);
+ {
+ /* erase file only if really empty on disk */
+ if (stat (ptr_dcc->local_filename, &st) != -1)
+ {
+ if ((unsigned long) st.st_size == 0)
+ unlink (ptr_dcc->local_filename);
+ }
+ }
if (DCC_IS_CHAT(ptr_dcc->type))
channel_remove_dcc (ptr_dcc);