1
0
mirror of https://github.com/irssi/irssi.git synced 2025-02-02 15:08:01 -05:00

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
This commit is contained in:
Timo Sirainen 2002-11-17 15:51:04 +00:00 committed by cras
parent 01f571a215
commit e5d506e31e

View File

@ -75,7 +75,7 @@ static void dcc_send_add(const char *servertag, CHAT_DCC_REC *chat,
struct stat st; struct stat st;
glob_t globbuf; glob_t globbuf;
char *fname; char *fname;
int i, files, flags, queue, start_new_transfer; int i, ret, files, flags, queue, start_new_transfer;
globbuf.gl_offs = 0; globbuf.gl_offs = 0;
flags = GLOB_NOCHECK | GLOB_TILDE; flags = GLOB_NOCHECK | GLOB_TILDE;
@ -100,13 +100,19 @@ static void dcc_send_add(const char *servertag, CHAT_DCC_REC *chat,
for (i = 0; i < globbuf.gl_pathc; i++) { for (i = 0; i < globbuf.gl_pathc; i++) {
const char *fname = globbuf.gl_pathv[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, signal_emit("dcc error file open", 3,
nick, fname, errno); nick, fname, errno);
continue; continue;
} }
if (S_ISREG(st.st_mode) && st.st_size > 0) {
if (queue < 0) { if (queue < 0) {
/* in append and prepend mode try to find an /* in append and prepend mode try to find an
old queue. if an old queue is not found old queue. if an old queue is not found
@ -125,7 +131,6 @@ static void dcc_send_add(const char *servertag, CHAT_DCC_REC *chat,
fname, servertag, chat); fname, servertag, chat);
files++; files++;
} }
}
if (files > 0 && start_new_transfer) if (files > 0 && start_new_transfer)
dcc_queue_send_next(queue); dcc_queue_send_next(queue);