Re: frequently updated pixbuf images disapear after a while



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.)


   FILE *fp = fopen(mapper_chk_cmd, "r");

   if(fp) {
       return TRUE;
   } else {
       return FALSE;
   }
   fclose(fp);

file descriptor leak.

   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);


   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?

}

-Peter



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