summaryrefslogtreecommitdiff
path: root/src/irc/dcc
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-11-17 15:51:04 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-11-17 15:51:04 +0000
commite5d506e31ec058f63521a7a08104d5ed0d0fbf3e (patch)
treea41d1df7b6f5c0ecf878d8958b5b6755a0d7f826 /src/irc/dcc
parent01f571a21546757f34b4862fb4c9bbbdf0fb1e0e (diff)
downloadirssi-e5d506e31ec058f63521a7a08104d5ed0d0fbf3e.zip
Less strict error checking, and notify about every error we do see.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3007 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/dcc')
-rw-r--r--src/irc/dcc/dcc-send.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/irc/dcc/dcc-send.c b/src/irc/dcc/dcc-send.c
index 5b427986..e872b065 100644
--- a/src/irc/dcc/dcc-send.c
+++ b/src/irc/dcc/dcc-send.c
@@ -75,7 +75,7 @@ static void dcc_send_add(const char *servertag, CHAT_DCC_REC *chat,
struct stat st;
glob_t globbuf;
char *fname;
- int i, files, flags, queue, start_new_transfer;
+ int i, ret, files, flags, queue, start_new_transfer;
globbuf.gl_offs = 0;
flags = GLOB_NOCHECK | GLOB_TILDE;
@@ -100,31 +100,36 @@ static void dcc_send_add(const char *servertag, CHAT_DCC_REC *chat,
for (i = 0; i < globbuf.gl_pathc; i++) {
const char *fname = globbuf.gl_pathv[i];
- if (stat(fname, &st) != 0) {
+ ret = stat(fname, &st);
+ if (ret == 0 && S_ISDIR(st.st_mode)) {
+ /* we don't want directories */
+ errno = EISDIR;
+ ret = -1;
+ }
+
+ if (ret < 0) {
signal_emit("dcc error file open", 3,
nick, fname, errno);
continue;
}
- if (S_ISREG(st.st_mode) && st.st_size > 0) {
+ if (queue < 0) {
+ /* in append and prepend mode try to find an
+ old queue. if an old queue is not found
+ create a new queue. if not in append or
+ prepend mode, create a new queue */
+ if (add_mode != DCC_QUEUE_NORMAL)
+ queue = dcc_queue_old(nick, servertag);
+ start_new_transfer = 0;
if (queue < 0) {
- /* in append and prepend mode try to find an
- old queue. if an old queue is not found
- create a new queue. if not in append or
- prepend mode, create a new queue */
- if (add_mode != DCC_QUEUE_NORMAL)
- queue = dcc_queue_old(nick, servertag);
- start_new_transfer = 0;
- if (queue < 0) {
- queue = dcc_queue_new();
- start_new_transfer = 1;
- }
+ queue = dcc_queue_new();
+ start_new_transfer = 1;
}
-
- dcc_queue_add(queue, add_mode, nick,
- fname, servertag, chat);
- files++;
}
+
+ dcc_queue_add(queue, add_mode, nick,
+ fname, servertag, chat);
+ files++;
}
if (files > 0 && start_new_transfer)