/* Get some file information by its file descriptor. */
void _ku_file_information(int fd, int *is_dir, ino_t *inode)
/* Get some file information by its file descriptor. */
void _ku_file_information(int fd, int *is_dir, ino_t *inode)
{
  g_assert (fd != -1);
  struct stat st;
  memset (&st, 0, sizeof (struct stat));
  if (fstat (fd, &st) == -1)
    {
      KU_W ("fstat failed, assuming it is just a file");
      is_dir = NULL;
      return;
    }
  if (is_dir != NULL)
      *is_dir = ((st.st_mode & S_IFDIR) == S_IFDIR) ? 1 : 0;
  if (inode != NULL)
      *inode = st.st_ino;
}