Re: frequently updated pixbuf images disapear after a while



On 8/27/06, Peter Firefly Lund <firefly diku dk> wrote:

On Sun, 27 Aug 2006, rupert wrote:

> {
>    gchar mapper_chk_cmd[128];
>
>    sprintf(mapper_chk_cmd, MAPPER_PATH, data);

mapper_chk_cmd = g_sprintf(MAPPER_PATH, data);

(if MAPPER_PATH is a format string with zero or one %s in it.)


i changed it to this

gchar mapper_chk_cmd;
mapper_chk_cmd = g_sprintf(MAPPER_PATH, data);

but now i get a warning about a wrong pointer assignment(translated into
english)
in the fopen call.




>    FILE *fp = fopen(mapper_chk_cmd, "r");
>
>    if(fp) {
>        return TRUE;
>    } else {
>        return FALSE;
>    }
>    fclose(fp);

file descriptor leak.


?? what  do you mean with that, how can i fix that?

   return TRUE;
> }
>
> gboolean crypto_mount_check(gchar *data)
> {
>    gchar mount_chk_cmd[128];
>    gchar buf[512];
>
>    sprintf(mount_chk_cmd, MOUNT_PATH, data);

mount_chk_cmd = g_sprintf(MOUNT_PATH, data);


same aS above


>    FILE *pp = popen(mount_chk_cmd, "r");
>
>    if(pp) {
>        size_t got = fread(buf, 1, sizeof(buf), pp);
>        pclose(pp);
>        if(got != 0) {

check also errno.

>            return TRUE;
>        } else {
>            return FALSE;
>        }
>    }
>
>    return TRUE;

why TRUE?


without I get a warning that a non-void function flew ends(translated.)

}

-Peter




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]