Hi,

1. _e_fm_op_copy_link()
we chmod the created symlink. It's useless, because
we use stat() which gives st_mode of pointed file/folder,
and then we use chmod(), which follows symlink; so we
are chmoding a file to the same permissions it had
before.

2. _e_fm_op_symlink_atom()
Just added overwrite handling.


Maxime
--- e_fm_op.c	2012-08-09 11:52:49.000000000 +0200
+++ e_fm_op.c	2012-08-12 12:46:32.846978686 +0200
@@ -1191,7 +1191,6 @@
    task->dst.done += task->src.st.st_size;
 
    _e_fm_op_update_progress(task, task->src.st.st_size, 0);
-   _e_fm_op_copy_stat_info(task);
 
    task->finished = 1;
 
@@ -1522,11 +1521,22 @@
 _e_fm_op_symlink_atom(E_Fm_Op_Task *task)
 {
    if (_e_fm_op_abort) return 1;
+   if (_e_fm_op_handle_overwrite(task)) return 1;
 
    E_FM_OP_DEBUG("Symlink: %s -> %s\n", task->src.name, task->dst.name);
 
    if (symlink(task->src.name, task->dst.name) != 0)
-     _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot create link from '%s' to '%s': %s.", task->src.name, task->dst.name);
+     {
+        if (errno == EEXIST)
+          {
+             if (unlink(task->dst.name) == -1)
+               _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot unlink '%s': %s.", task->dst.name);
+             if (symlink(task->src.name, task->dst.name) == -1)
+               _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot create link from '%s' to '%s': %s.", task->src.name, task->dst.name);
+          }
+        else
+          _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot create link from '%s' to '%s': %s.", task->src.name, task->dst.name);
+     }
 
    task->dst.done += REMOVECHUNKSIZE;
    _e_fm_op_update_progress(task, REMOVECHUNKSIZE, 0);
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to