1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

core: display error (only once) when bad file descriptor is detected in hook_fd

This commit is contained in:
Sebastien Helleu
2011-06-22 15:39:00 +02:00
parent 6defc05f0a
commit 2a630031fd
16 changed files with 80 additions and 17 deletions
+2 -1
View File
@@ -444,7 +444,8 @@
| weechat | hook_fd | Hook vom Typ "fd" |
'callback' (pointer) +
'fd' (integer) +
'flags' (integer) |
'flags' (integer) +
'error' (integer) |
'last_weechat_hook_fd' +
'weechat_hooks_fd'
+2 -1
View File
@@ -444,7 +444,8 @@
| weechat | hook_fd | hook of type "fd" |
'callback' (pointer) +
'fd' (integer) +
'flags' (integer) |
'flags' (integer) +
'error' (integer) |
'last_weechat_hook_fd' +
'weechat_hooks_fd'
+2 -1
View File
@@ -444,7 +444,8 @@
| weechat | hook_fd | hook de type "fd" |
'callback' (pointer) +
'fd' (integer) +
'flags' (integer) |
'flags' (integer) +
'error' (integer) |
'last_weechat_hook_fd' +
'weechat_hooks_fd'
+2 -1
View File
@@ -444,7 +444,8 @@
| weechat | hook_fd | hook of type "fd" |
'callback' (pointer) +
'fd' (integer) +
'flags' (integer) |
'flags' (integer) +
'error' (integer) |
'last_weechat_hook_fd' +
'weechat_hooks_fd'
+5 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-06-13 21:33+0200\n"
"POT-Creation-Date: 2011-06-22 15:36+0200\n"
"PO-Revision-Date: 2011-05-15 10:51+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2694,6 +2694,10 @@ msgid "System clock skew detected (%+ld seconds), reinitializing all timers"
msgstr ""
"Detekován posun systémových hodin (%+ld sekund), znovu inicializuji časovače"
#, c-format
msgid "%sError: bad file descriptor (%d) used in hook_fd"
msgstr ""
#, c-format
msgid "End of command '%s', timeout reached (%.1fs)"
msgstr "Konec příkazu '%s', vypršel časový limit (%.lfs)"
+5 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-06-22 10:56+0200\n"
"POT-Creation-Date: 2011-06-22 15:36+0200\n"
"PO-Revision-Date: 2011-06-15 18:51+0100\n"
"Last-Translator: Nils G.\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2832,6 +2832,10 @@ msgid "System clock skew detected (%+ld seconds), reinitializing all timers"
msgstr ""
"Die Systemzeit ist nicht korrekt (%+ld Sekunden), reinitialisiere alle Uhren"
#, c-format
msgid "%sError: bad file descriptor (%d) used in hook_fd"
msgstr ""
#, c-format
msgid "End of command '%s', timeout reached (%.1fs)"
msgstr "Befehl '%s' beendet, Zeit ist verstrichen (%.1fs)"
+5 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-06-13 21:33+0200\n"
"POT-Creation-Date: 2011-06-22 15:36+0200\n"
"PO-Revision-Date: 2011-05-15 10:51+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2746,6 +2746,10 @@ msgstr ""
"Desviación detectada en el reloj del sistema (%+ld segundos), reiniciando "
"todos los temporizadores"
#, c-format
msgid "%sError: bad file descriptor (%d) used in hook_fd"
msgstr ""
#, c-format
msgid "End of command '%s', timeout reached (%.1fs)"
msgstr "Fin del comando '%s', tiempo de espera alcanzado (%.1fs)"
+6 -2
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-06-13 21:33+0200\n"
"PO-Revision-Date: 2011-06-13 21:33+0200\n"
"POT-Creation-Date: 2011-06-22 15:36+0200\n"
"PO-Revision-Date: 2011-06-22 15:28+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@@ -2777,6 +2777,10 @@ msgstr ""
"Décalage de l'horloge système détecté (%+ld secondes), réinitialisation de "
"tous les minuteurs"
#, c-format
msgid "%sError: bad file descriptor (%d) used in hook_fd"
msgstr "%sErreur: mauvais descripteur de fichier (%d) utilisé dans hook_fd"
#, c-format
msgid "End of command '%s', timeout reached (%.1fs)"
msgstr "Fin de la commande '%s', temps maximum atteint (%.1fs)"
+5 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-06-13 21:33+0200\n"
"POT-Creation-Date: 2011-06-22 15:36+0200\n"
"PO-Revision-Date: 2011-05-15 10:51+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2395,6 +2395,10 @@ msgstr "%s az ignore már létezik\n"
msgid "System clock skew detected (%+ld seconds), reinitializing all timers"
msgstr ""
#, c-format
msgid "%sError: bad file descriptor (%d) used in hook_fd"
msgstr ""
#, c-format
msgid "End of command '%s', timeout reached (%.1fs)"
msgstr ""
+5 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-06-13 21:33+0200\n"
"POT-Creation-Date: 2011-06-22 15:36+0200\n"
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2746,6 +2746,10 @@ msgstr ""
"Rilevato ritardo nell'orologio di sistema (%+ld secondi), reset di tutti i "
"timer"
#, c-format
msgid "%sError: bad file descriptor (%d) used in hook_fd"
msgstr ""
#, c-format
msgid "End of command '%s', timeout reached (%.1fs)"
msgstr "Fine comando '%s', timeout raggiunto (%.1fs)"
+5 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-06-13 21:33+0200\n"
"POT-Creation-Date: 2011-06-22 15:36+0200\n"
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2730,6 +2730,10 @@ msgstr ""
"Wykryto odchylenie zegara systemowego (%+ld sekund), reinicjalisuje "
"wszystkie timery"
#, c-format
msgid "%sError: bad file descriptor (%d) used in hook_fd"
msgstr ""
#, c-format
msgid "End of command '%s', timeout reached (%.1fs)"
msgstr "Kończenie komendy '%s', przekroczono dopuszczalny czas (%.1fs)"
+5 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-06-13 21:33+0200\n"
"POT-Creation-Date: 2011-06-22 15:36+0200\n"
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
"Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2658,6 +2658,10 @@ msgstr ""
msgid "System clock skew detected (%+ld seconds), reinitializing all timers"
msgstr ""
#, c-format
msgid "%sError: bad file descriptor (%d) used in hook_fd"
msgstr ""
#, c-format
msgid "End of command '%s', timeout reached (%.1fs)"
msgstr ""
+5 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.6-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-06-13 21:33+0200\n"
"POT-Creation-Date: 2011-06-22 15:36+0200\n"
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2410,6 +2410,10 @@ msgstr "%s игнорирование уже существует\n"
msgid "System clock skew detected (%+ld seconds), reinitializing all timers"
msgstr ""
#, c-format
msgid "%sError: bad file descriptor (%d) used in hook_fd"
msgstr ""
#, c-format
msgid "End of command '%s', timeout reached (%.1fs)"
msgstr ""
+5 -1
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-06-13 21:33+0200\n"
"POT-Creation-Date: 2011-06-22 15:36+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -2062,6 +2062,10 @@ msgstr ""
msgid "System clock skew detected (%+ld seconds), reinitializing all timers"
msgstr ""
#, c-format
msgid "%sError: bad file descriptor (%d) used in hook_fd"
msgstr ""
#, c-format
msgid "End of command '%s', timeout reached (%.1fs)"
msgstr ""
+19 -2
View File
@@ -1194,6 +1194,7 @@ hook_fd (struct t_weechat_plugin *plugin, int fd, int flag_read,
new_hook_fd->callback = callback;
new_hook_fd->fd = fd;
new_hook_fd->flags = 0;
new_hook_fd->error = 0;
if (flag_read)
new_hook_fd->flags |= HOOK_FD_FLAG_READ;
if (flag_write)
@@ -1224,8 +1225,20 @@ hook_fd_set (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds)
if (!ptr_hook->deleted)
{
/* skip invalid file descriptors */
if ((fcntl (HOOK_FD(ptr_hook,fd), F_GETFD) != -1)
|| (errno != EBADF))
if ((fcntl (HOOK_FD(ptr_hook,fd), F_GETFD) == -1)
&& (errno == EBADF))
{
if (HOOK_FD(ptr_hook, error) == 0)
{
HOOK_FD(ptr_hook, error) = errno;
gui_chat_printf (NULL,
_("%sError: bad file descriptor (%d) "
"used in hook_fd"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
HOOK_FD(ptr_hook, fd));
}
}
else
{
if (HOOK_FD(ptr_hook, flags) & HOOK_FD_FLAG_READ)
{
@@ -3152,6 +3165,7 @@ hook_hdata_hook_fd_cb (void *data, const char *hdata_name)
HDATA_VAR(struct t_hook_fd, callback, POINTER);
HDATA_VAR(struct t_hook_fd, fd, INTEGER);
HDATA_VAR(struct t_hook_fd, flags, INTEGER);
HDATA_VAR(struct t_hook_fd, error, INTEGER);
hdata_new_list(hdata, "weechat_hooks_fd", &weechat_hooks[HOOK_TYPE_FD]);
hdata_new_list(hdata, "last_weechat_hook_fd", &last_weechat_hook[HOOK_TYPE_FD]);
}
@@ -3654,6 +3668,8 @@ hook_add_to_infolist_type (struct t_infolist *infolist, int type,
return 0;
if (!infolist_new_var_integer (ptr_item, "flags", HOOK_FD(ptr_hook, flags)))
return 0;
if (!infolist_new_var_integer (ptr_item, "error", HOOK_FD(ptr_hook, error)))
return 0;
}
break;
case HOOK_TYPE_PROCESS:
@@ -4051,6 +4067,7 @@ hook_print_log ()
log_printf (" callback. . . . . . . : 0x%lx", HOOK_FD(ptr_hook, callback));
log_printf (" fd. . . . . . . . . . : %d", HOOK_FD(ptr_hook, fd));
log_printf (" flags . . . . . . . . : %d", HOOK_FD(ptr_hook, flags));
log_printf (" error . . . . . . . . : %d", HOOK_FD(ptr_hook, error));
}
break;
case HOOK_TYPE_PROCESS:
+2
View File
@@ -174,6 +174,8 @@ struct t_hook_fd
t_hook_callback_fd *callback; /* fd callback */
int fd; /* socket or file descriptor */
int flags; /* fd flags (read,write,..) */
int error; /* contains errno if error occured */
/* with fd */
};
/* hook process */