efreet: fix old cache deletion

SVN revision: 47538
This commit is contained in:
Sebastian Dransfeld 2010-03-28 19:31:26 +00:00
parent d075ee43c2
commit d504b34ac3
1 changed files with 9 additions and 19 deletions

View File

@ -209,30 +209,11 @@ main()
dir = ecore_file_dir_get(efreet_desktop_cache_file());
if (!ecore_file_mkpath(dir)) goto efreet_error;
free(dir);
/* unlink old cache file */
if (unlink(efreet_desktop_cache_file()) < 0)
{
if (errno != ENOENT) goto efreet_error;
}
/* create desktop cache file, so that efreet_init wont run another instance of this program */
fd = open(efreet_desktop_cache_file(), O_CREAT | O_EXCL | O_RDONLY, S_IRUSR | S_IWUSR);
if (fd < 0) goto efreet_error;
close(fd);
/* create dir for util cache */
dir = ecore_file_dir_get(efreet_desktop_util_cache_file());
if (!ecore_file_mkpath(dir)) goto efreet_error;
free(dir);
/* unlink old cache file */
if (unlink(efreet_desktop_util_cache_file()) < 0)
{
if (errno != ENOENT) goto efreet_error;
}
/* create util cache file */
fd = open(efreet_desktop_util_cache_file(), O_CREAT | O_EXCL | O_RDONLY, S_IRUSR | S_IWUSR);
if (fd < 0) goto efreet_error;
close(fd);
/* finish efreet init */
if (!efreet_init()) goto efreet_error;
@ -321,6 +302,15 @@ main()
eet_close(util_ef);
eet_close(ef);
/* unlink old cache files */
if (unlink(efreet_desktop_cache_file()) < 0)
{
if (errno != ENOENT) goto error;
}
if (unlink(efreet_desktop_util_cache_file()) < 0)
{
if (errno != ENOENT) goto error;
}
/* rename tmp files to real files */
if (rename(util_file, efreet_desktop_util_cache_file()) < 0) goto error;
if (rename(file, efreet_desktop_cache_file()) < 0) goto error;