if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 || (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) {  tmp->newly_created = 1; tmp->magic = 0;
{ tmp->new = 0;  if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 || (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0)) {  tmp->newly_created = 1; tmp->magic = 0;
int mutt_buffy_check (int force){  BUFFY *tmp;  struct stat sb;  struct dirent *de;  DIR *dirp;  char path[_POSIX_PATH_MAX];  struct stat contex_sb;  time_t t;  /* fastest return if there are no mailboxes */  if (!Incoming)    return 0;  t = time (NULL);  if (!force && t - BuffyTime < BuffyTimeout)    return BuffyCount;   BuffyTime = t;  BuffyCount = 0;  BuffyNotify = 0;  /* check device ID and serial number instead of comparing paths */  if (!Context || !Context->path || stat (Context->path, &contex_sb) != 0)  {    contex_sb.st_dev=0;    contex_sb.st_ino=0;  }    for (tmp = Incoming; tmp; tmp = tmp->next)  {    tmp->new = 0;#ifdef USE_IMAP    if ((tmp->magic == M_IMAP) || mx_is_imap (tmp->path))    {      tmp->magic = M_IMAP;    }    else#endif    if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 ||	(!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0))    {      /* if the mailbox still doesn't exist, set the newly created flag to       * be ready for when it does.       */      tmp->newly_created = 1;      tmp->magic = 0;#ifdef BUFFY_SIZE      tmp->size = 0;#endif      continue;    }    if (!Context || !Context->path || 	sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino)    {      switch (tmp->magic)      {      case M_MBOX:      case M_MMDF:      case M_KENDRA:	if (STAT_CHECK)	{	  BuffyCount++;	  tmp->new = 1;	}#ifdef BUFFY_SIZE	else	{	  /* some other program has deleted mail from the folder */	  tmp->size = (long) sb.st_size;	}#endif	if (tmp->newly_created &&	    (sb.st_ctime != sb.st_mtime || sb.st_ctime != sb.st_atime))	  tmp->newly_created = 0;	break;      case M_MAILDIR:      case M_MH:	if(tmp->magic == M_MAILDIR)	  snprintf (path, sizeof (path), "%s/new", tmp->path);	else	  strfcpy (path, tmp->path, sizeof(path));	if ((dirp = opendir (path)) == NULL)	{	  tmp->magic = 0;	  break;	}	while ((de = readdir (dirp)) != NULL)	{	  if (*de->d_name != '.')	  {	    /* one new message is enough */	    BuffyCount++;	    tmp->new = 1;	    break;	  }	}	closedir (dirp);	break;#ifdef USE_IMAP      case M_IMAP:	if (imap_buffy_check (tmp->path) > 0)	{	  BuffyCount++;	  tmp->new = 1;	}	break;#endif      }    }#ifdef BUFFY_SIZE    else if (Context && Context->path)      tmp->size = (long) sb.st_size;	/* update the size */#endif    if (!tmp->new)      tmp->notified = 0;    else if (!tmp->notified)      BuffyNotify++;  }  BuffyDoneTime = BuffyTime;  return (BuffyCount);}