Re: frequently updated pixbuf images disapear after a while
- From: rupert <rupertt gmail com>
- To: "Peter Firefly Lund" <firefly diku dk>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: frequently updated pixbuf images disapear after a while
- Date: Sun, 27 Aug 2006 12:36:53 +0200
On 8/27/06, Peter Firefly Lund <firefly diku dk> wrote:
On Sun, 27 Aug 2006, rupert wrote:
> the g_sprintf returns the number of characters, so i should use it like
the
> normal sprintf,
> gchar *mapper_chk_cmd;
> g_sprintf(mapper_chk_cmd, "/dev/mapper/%s", data);
>
> but it doesnt seem to help, the segfault is there, too
Sorry, I meant g_strdup_printf().
> when i init it with gchar mount_chk_cmd[128]; i can use it like
> with sprintf, but i cant free the memory for these gchars.
>
> I got the warning with the g_sprintf, but i think it was because it
returned
> int
>
> i removed the fclose and pclose, but the app also crashed after a while
with
> the same
> symptoms.
>
The file descriptor thing has nothing to do with the segfaults. They were
a separate problem.
strange, i rewrote the function to have a better overview, one file i can
close the other not.
gboolean crypto_mapper_check(gchar *data)
{
gchar *mapper_chk_cmd;
gboolean result_mapper=FALSE;
mapper_chk_cmd = g_strdup_printf("/dev/mapper/%s", data);
FILE *fp = fopen(mapper_chk_cmd, "r");
g_free(mapper_chk_cmd);
if(fp)
result_mapper = TRUE;
else
result_mapper = FALSE;
//fclose(fp); /* this one crashes the the app when enabled*/
return result_mapper;
}
# define MOUNT_PATH "cat /proc/mounts|grep %s"
gboolean crypto_mount_check(gchar *data)
{
gchar *mount_chk_cmd;
gchar buf[512];
gboolean result_mount=FALSE;
mount_chk_cmd = g_strdup_printf(MOUNT_PATH, data);
FILE *pp = popen(mount_chk_cmd, "r");
g_free(mount_chk_cmd);
if(pp) {
size_t got = fread(buf, 1, sizeof(buf), pp);
if(got != 0)
result_mount = TRUE;
else
result_mount = FALSE;
}
pclose(pp);
return result_mount;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]