before c65782b15c the acutal path has
been filled into buf, with eina_file_mkstemp the string is filled into
tmpstr, so that path should be chmoded instead of the template buf.
Thx to MatP for the report!
Summary:
Some parameter's name are different in annotations and statements,
so it occurs doxygen warning.
To fix it, rename that parameters.
Test Plan: API Doxygen Revision
Reviewers: raster, cedric, jpeg, myoungwoon, Jaehyun_Cho
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D5313
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
Summary:
If the file with a new path was created and 'rename' wants to replace the old path to the new path. 'rename' will return:
Windows 7: -1 (errno=EEXIST) (EEXIST == 17)
Ubuntu: 0
**EEXIST**
**Ubuntu**: The link named by new is a directory that is not an empty directory. (https://linux.die.net/man/3/rename)
**Windows 7**: Files exist. An attempt has been made to create a file that already exists. For example, the _O_CREAT and _O_EXCL flags are specified in an _open call, but the named file already exists.(https://msdn.microsoft.com/en-us/library/5814770t.aspx)
Test Plan:
**Sample code to rename in Linux and Windows if the file with the new name already exists:**
int main()
{
const char *_old = "old";
const char *_new = "new";
int fd1 = open(_old, O_CREAT);
close(fd1);
int fd2 = open(_new, O_CREAT);
close(fd2);
printf("rename:\t%s -> %s\n", _old, _new);
int r = rename(_old, _new);
if (r == 0)
{
printf("GOOD\n");
}
else
{
printf("CODE ERROR:\n" );
printf(" -rename...: %d\n", r );
printf(" -errno....: %d\n", errno);
}
return 0;
}
Reviewers: raster, vtorri, jpeg, NikaWhite, reutskiy.v.v, an.kroitor, cedric
Reviewed By: cedric
Subscribers: artem.popov, cedric, jpeg
Tags: #efl, #windows
Differential Revision: https://phab.enlightenment.org/D4561
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
On Windows, both backslash and slash can be used as file path
separators. Therefore, it is fixed to consider backslash as a file path
separator as well on Windows.
@fix
On windows, stat() returns -1 if a path is finished with a \ or /,
so replace all stat() calls with a function which removes the trailing
slash or backslash on Windows
At this stage the code duplicate many code path for avoiding potential
borkage on Unix system. During 1.17 release cycle, it would be nice to
refactor this piece.
@fix
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
valgrind was most unhappy with ecore_file_app_exe_get(). like:
==8331== Invalid write of size 1
==8331== at 0x68DE90A: ecore_file_app_exe_get (ecore_file.c:994)
==8331== Address 0x1348e58f is 0 bytes after a block of size 31 alloc'd
==8331== at 0x4C28C20: malloc (vg_replace_malloc.c:296)
==8331== Invalid write of size 1
==8331== at 0x68DE948: ecore_file_app_exe_get (ecore_file.c:1000)
==8331== Address 0x1348e599 is 10 bytes after a block of size 31 alloc'd
==8331== at 0x4C28C20: malloc (vg_replace_malloc.c:296)
etc. etc. - so i rewrote it cleanly using strbuf to save code and
effort. cleaner now and ACTUALLY works correctly... and no valgrind
complaints.
@fix
this actually fixes the issue. coverity did point it out but i fixed
it incorrectly. since it was still there in the scan i now fixed it
properly. fixes CID 1039279