wtf? thats like double-free land.. why strdupa at all? nuts! remove

strdupa's and make code consistent with neighbouring code.



SVN revision: 81006
This commit is contained in:
Carsten Haitzler 2012-12-15 01:56:35 +00:00
parent 8a38414ec8
commit 320ec625b0
1 changed files with 9 additions and 21 deletions

View File

@ -1238,42 +1238,30 @@ _e_fm_op_copy_link(E_Fm_Op_Task *task)
lnk_path = ecore_file_readlink(task->src.name); lnk_path = ecore_file_readlink(task->src.name);
if (!lnk_path) if (!lnk_path)
{ _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR,
_E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot read link '%s'.", task->src.name); "Cannot read link '%s'.", task->src.name);
}
E_FM_OP_DEBUG("Creating link from '%s' to '%s'\n", lnk_path, task->dst.name); E_FM_OP_DEBUG("Creating link from '%s' to '%s'\n", lnk_path, task->dst.name);
_e_fm_op_update_progress_report_simple(0, lnk_path, task->dst.name); _e_fm_op_update_progress_report_simple(0, lnk_path, task->dst.name);
if (symlink(lnk_path, task->dst.name) == -1) if (symlink(lnk_path, task->dst.name) == -1)
{ {
char *buf;
if (errno == EEXIST) if (errno == EEXIST)
{ {
if (unlink(task->dst.name) == -1) if (unlink(task->dst.name) == -1)
{ _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR,
free(lnk_path); "Cannot unlink '%s': %s.", task->dst.name);
_E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot unlink '%s': %s.", task->dst.name); else if (symlink(lnk_path, task->dst.name) == -1)
} _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR,
if (symlink(lnk_path, task->dst.name) == -1) "Cannot create link from '%s' to '%s': %s.", lnk_path, task->dst.name);
{
buf = strdupa(lnk_path);
free(lnk_path);
_E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot create link from '%s' to '%s': %s.", buf, task->dst.name);
}
} }
else else
{ _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR,
buf = strdupa(lnk_path); "Cannot create link from '%s' to '%s': %s.", lnk_path, task->dst.name);
free(lnk_path);
_E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot create link from '%s' to '%s': %s.", buf, task->dst.name);
}
} }
free(lnk_path); free(lnk_path);
task->dst.done += task->src.st.st_size; task->dst.done += task->src.st.st_size;
_e_fm_op_update_progress(task, task->src.st.st_size, 0); _e_fm_op_update_progress(task, task->src.st.st_size, 0);
task->finished = 1; task->finished = 1;