bugfixes
This commit is contained in:
parent
3509b7bb72
commit
35e4aa61c7
@ -1,3 +1,10 @@
|
|||||||
|
2009-07-29 Frederic Culot <frederic@culot.org>
|
||||||
|
|
||||||
|
* src/custom.c (custom_load_conf): use a larger buffer to read
|
||||||
|
configuration data
|
||||||
|
|
||||||
|
* src/io.c (io_extract_data): do not read past the maximum length
|
||||||
|
|
||||||
2009-07-27 Frederic Culot <frederic@culot.org>
|
2009-07-27 Frederic Culot <frederic@culot.org>
|
||||||
|
|
||||||
* src/utils.c (free_user_data): new function
|
* src/utils.c (free_user_data): new function
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $calcurse: custom.c,v 1.41 2009/07/12 17:55:13 culot Exp $ */
|
/* $calcurse: custom.c,v 1.42 2009/07/29 18:20:54 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -222,7 +222,7 @@ custom_load_conf (conf_t *conf, int background)
|
|||||||
FILE *data_file;
|
FILE *data_file;
|
||||||
char *mesg_line1 = _("Failed to open config file");
|
char *mesg_line1 = _("Failed to open config file");
|
||||||
char *mesg_line2 = _("Press [ENTER] to continue");
|
char *mesg_line2 = _("Press [ENTER] to continue");
|
||||||
char buf[100], e_conf[100];
|
char buf[BUFSIZ], e_conf[BUFSIZ];
|
||||||
int var;
|
int var;
|
||||||
|
|
||||||
data_file = fopen (path_conf, "r");
|
data_file = fopen (path_conf, "r");
|
||||||
@ -237,11 +237,11 @@ custom_load_conf (conf_t *conf, int background)
|
|||||||
pthread_mutex_lock (&nbar.mutex);
|
pthread_mutex_lock (&nbar.mutex);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (fgets (buf, 99, data_file) == NULL)
|
if (fgets (buf, sizeof buf, data_file) == NULL)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
io_extract_data (e_conf, buf, strlen (buf));
|
io_extract_data (e_conf, buf, sizeof buf);
|
||||||
|
|
||||||
switch (var)
|
switch (var)
|
||||||
{
|
{
|
||||||
|
11
src/io.c
11
src/io.c
@ -1,4 +1,4 @@
|
|||||||
/* $calcurse: io.c,v 1.75 2009/07/27 21:00:41 culot Exp $ */
|
/* $calcurse: io.c,v 1.76 2009/07/29 18:20:55 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -795,11 +795,12 @@ io_init (char *cfile, char *datadir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get data from file */
|
|
||||||
void
|
void
|
||||||
io_extract_data (char *dst_data, const char *org, int len)
|
io_extract_data (char *dst_data, const char *org, int len)
|
||||||
{
|
{
|
||||||
for (;;)
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < len - 1; i++)
|
||||||
{
|
{
|
||||||
if (*org == '\n' || *org == '\0')
|
if (*org == '\n' || *org == '\0')
|
||||||
break;
|
break;
|
||||||
@ -1296,11 +1297,11 @@ io_load_todo (void)
|
|||||||
else
|
else
|
||||||
note[0] = '\0';
|
note[0] = '\0';
|
||||||
/* Then read todo description. */
|
/* Then read todo description. */
|
||||||
(void)fgets (buf, BUFSIZ, data_file);
|
(void)fgets (buf, sizeof buf, data_file);
|
||||||
newline = strchr (buf, '\n');
|
newline = strchr (buf, '\n');
|
||||||
if (newline)
|
if (newline)
|
||||||
*newline = '\0';
|
*newline = '\0';
|
||||||
io_extract_data (e_todo, buf, strlen (buf));
|
io_extract_data (e_todo, buf, sizeof buf);
|
||||||
todo_add (e_todo, id, note);
|
todo_add (e_todo, id, note);
|
||||||
++nb_tod;
|
++nb_tod;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user