[ekg2-commit] r4095 - trunk/plugins/logs: trunk/plugins/logs/main.c
SVN commit
svn w toxygen.net
Czw, 10 Lip 2008, 19:28:22 CEST
Author: darkjames
Date: 2008-07-10 19:28:22 +0200 (Thu, 10 Jul 2008)
New Revision: 4095
Modified:
trunk/plugins/logs/main.c
Log:
logs:
when we fclose() file, we should do: l->file = NULL
it should fix daily-segvs when you have %D in your logs:path
Modified: trunk/plugins/logs/main.c
===================================================================
--- trunk/plugins/logs/main.c 2008-07-10 14:13:11 UTC (rev 4094)
+++ trunk/plugins/logs/main.c 2008-07-10 17:28:22 UTC (rev 4095)
@@ -310,7 +310,7 @@
}
if (chan > 0) {
if (l->file) { /* jesli plik byl otwarty otwieramy go z nowa sciezka */
- fclose(l->file);
+ fclose(l->file); l->file = NULL;
l->file = logs_open_file(l->path, l->logformat);
}
}
@@ -340,9 +340,10 @@
if (log_curlog && log_curlog->lw) {
log_window_t *lw = log_curlog->lw;
xfree(lw->path);
- if (lw->file) /* w sumie jesli jest NULL to byl jakis blad przy fopen()... */
+ if (lw->file) {
fclose(lw->file);
- lw->file = NULL;
+ lw->file = NULL;
+ }
xfree(lw);
log_curlog->lw = NULL;
}
@@ -423,13 +424,16 @@
logs_log_t *ll = l->data;
if (ll->lw) {
- FILE *f = ll->lw->file;
- char *tmp = ll->lw->path;
- ll->lw->path = NULL;
- ll->lw->file = NULL;
- if (f) fclose(f);
- xfree(tmp);
/* We don't need reopening file../ recreate magic struct.. because it'd be done when we try log smth into it. */
+ if (ll->lw->file) {
+ fclose(ll->lw->file);
+ ll->lw->file = NULL;
+ }
+
+ if (ll->lw->path) {
+ xfree(ll->lw->path);
+ ll->lw->path = NULL;
+ }
}
}
}
Więcej informacji o liście dyskusyjnej ekg2-commit