Hi All,
Please find below fct that fixes this issue. The diff of the patch
is available in the bug report.
The fix checks if a given path reference a loopback filesystem. If
so the lofs mountpoint is replaced
by its counterpart and that composite path is returned.
This make the time slider visualization patch in nautilus behaving
as expected with lofs automounted directories.
char* ts_realpath (char * dir, char *resolved_name)
{
char real_dir[PATH_MAX+1];
char real_path[PATH_MAX+1];
gboolean found = FALSE;
struct stat64 dir_stat64;
char *result;
result = realpath(dir, real_dir);
if (!result)
return NULL;
if (stat64 (real_dir, &dir_stat64) == 0)
{
if (strcmp (dir_stat64.st_fstype, "lofs") == 0)
{
FILE *fp;
struct extmnttab mtab;
int status;
fp = fopen (MNTTAB,"r");
resetmnttab(fp);
while ((status = getextmntent(fp, &mtab, sizeof (struct
extmnttab))) == 0)
{
if (strcmp (mtab.mnt_fstype, "lofs") == 0)
{
dev_t dev = NODEV;
dev = makedev(mtab.mnt_major, mtab.mnt_minor);
if (dev == dir_stat64.st_dev)
{
if (strcmp (real_dir, mtab.mnt_mountp) == 0)
strcpy (real_path, mtab.mnt_special);
else
{
gchar **split;
split = g_strsplit (real_dir, mtab.mnt_mountp, 2);
/*split 2nd part contains path without mount point */
sprintf (real_path,"%s%s",mtab.mnt_special,split[1]);
g_strfreev (split);
}
found = TRUE;
break;
}
}
}
(void) fclose(fp);
}
}
if (found)
return strcpy (resolved_name, real_path);
else
return strcpy (resolved_name, real_dir);
}
--
Erwann Ch?ned?,
Desktop Group, Sun Microsystems, Grenoble