[Commits] ldifimport_parser.c 1.1 1.2 ldifimport_parser.h 1.1 1.2
miras at claws-mail.org
miras at claws-mail.org
Sat Dec 17 16:55:07 CET 2011
Update of /home/claws-mail/contacts/extensions/import
In directory claws-mail:/tmp/cvs-serv26266/extensions/import
Modified Files:
ldifimport_parser.c ldifimport_parser.h
Log Message:
2011-12-17 [mir] 0.6.0cvs53
* extensions/import/ldifimport_parser.c
* extensions/import/ldifimport_parser.h
If file to read from is given as filename
then the extension must open file for read
in which case the extension will also be
responsible for closing the file handle.
Index: ldifimport_parser.h
===================================================================
RCS file: /home/claws-mail/contacts/extensions/import/ldifimport_parser.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ldifimport_parser.h 17 Dec 2011 02:55:13 -0000 1.1
+++ ldifimport_parser.h 17 Dec 2011 15:55:05 -0000 1.2
@@ -96,6 +96,7 @@
guint position;
guint end;
gint input_fd;
+ gboolean open_fd_by_me;
gchar* buffer;
gchar* input_name;
GHashTable* symbols;
Index: ldifimport_parser.c
===================================================================
RCS file: /home/claws-mail/contacts/extensions/import/ldifimport_parser.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ldifimport_parser.c 17 Dec 2011 02:55:13 -0000 1.1
+++ ldifimport_parser.c 17 Dec 2011 15:55:05 -0000 1.2
@@ -318,7 +318,7 @@
Token* token;
list = ldif_parser_strsplit(parser);
- //gslist_free(&parser->records, ldif_parser_record_free);
+ gslist_free(&parser->records, ldif_parser_record_free);
cur = list;
while (cur) {
record = (Record *) cur->data;
@@ -363,7 +363,7 @@
ldif_parser_read_file(parser);
if (parser->fatal_error)
result = TRUE;
-
+
ldif_parser_scan_file(parser);
if (parser->fatal_error)
result = TRUE;
@@ -509,6 +509,9 @@
if (! parser)
return;
+ if (parser->open_fd_by_me)
+ close(parser->input_fd);
+
g_free(parser->buffer);
g_free(parser->input_name);
g_free(parser->error_msg);
@@ -538,6 +541,7 @@
parser->fatal_error = TRUE;
return;
}
+ parser->open_fd_by_me = FALSE;
#ifdef G_OS_UNIX
GError* error = NULL;
gchar* name = g_strdup_printf("/proc/self/fd/%d", fd);
@@ -572,6 +576,7 @@
ldif_parser_set_error(parser, LDIF_PARSER_BAD_FILE, err);
return;
}
+ parser->open_fd_by_me = TRUE;
parser->input_fd = fd;
g_free(parser->input_name);
parser->input_name = g_strdup(file);
More information about the Commits
mailing list