E17: fix race condition when copying a file
authorVincent Torri <vincent.torri@gmail.com>
Sat, 21 Jul 2012 18:20:19 +0000 (18:20 +0000)
committerVincent Torri <vincent.torri@gmail.com>
Sat, 21 Jul 2012 18:20:19 +0000 (18:20 +0000)
during the copy, the file can be accessed by users.
See http://cwe.mitre.org/data/definitions/689.html
So we apply the access rights after the creation of
the dest file.

Patch by Maxime Villard

SVN revision: 74284

src/bin/e_fm_op.c

index 64b3c1f..1ea4cae 100644 (file)
@@ -1250,6 +1250,7 @@ _e_fm_op_open_files(E_Fm_Op_Task *task)
         data->to = fopen(task->dst.name, "wb");
         if (!data->to)
           _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot open file '%s' for writing: %s.", task->dst.name);
+        _e_fm_op_copy_stat_info(task);
      }
 
    return 0;