From: Maxime Villard <rustyBSD@gmx.fr>

There is a problem with the realpath() call. When moving
a symlink, realpath() gets the path of the pointed file,
and the name assigned to the copied link is the name of
this file.

So we shouldn't use realpath(), but I don't know an equivalent
which doesn't take care of symlinks.

Here is an example patch.


SVN revision: 76721
This commit is contained in:
Maxime Villard 2012-09-17 03:57:04 +00:00 committed by Mike Blumenkrantz
parent e406dbd435
commit 3dc989c695
1 changed files with 4 additions and 29 deletions

View File

@ -230,14 +230,14 @@ main(int argc, char **argv)
done = 0;
total = last - 2;
char *p;
for (; i < last; i++)
{
char *p = ecore_file_realpath(argv[i]);
p = argv[i];
const char *name;
int name_len;
if (!p) continue;
/* Don't move a dir into itself */
if (ecore_file_is_dir(p) &&
(strncmp(p, p2, PATH_MAX) == 0) &&
@ -317,7 +317,7 @@ main(int argc, char **argv)
}
skip_arg:
E_FREE(p);
continue;
}
E_FREE(p2);
@ -1385,31 +1385,6 @@ _e_fm_op_copy_atom(E_Fm_Op_Task *task)
task->finished = 1;
return 1;
}
if (S_ISLNK(task->src.st.st_mode))
{
char *dst_dir;
dst_dir = ecore_file_dir_get(task->dst.name);
if (dst_dir)
{
const char *dst_name;
dst_name = ecore_file_file_get(task->src.name);
if (dst_name)
{
char dst_path[PATH_MAX];
if ((strlen(dst_dir) + strlen(dst_name)) >= PATH_MAX)
_E_FM_OP_ERROR_SEND_WORK(task, 0, "Not copying link: path too long", dst_path);
snprintf(dst_path, sizeof(dst_path), "%s/%s", dst_dir, dst_name);
task->dst.name = strdup(dst_path);
}
E_FREE(dst_dir);
}
}
if (_e_fm_op_handle_overwrite(task)) return 1;
if (S_ISDIR(task->src.st.st_mode))