Commit Graph

90 Commits

Author SHA1 Message Date
Jean-Philippe Andre 0fdb02fb51 Eina: Add support for file extensions in eina_mkstemp
Using mkstemps
2014-04-02 11:54:44 +09:00
Cedric Bail 3e89295c73 eina: fix memory leak of inserting the wrong value in the hash.
We where inserting the pointer data instead of the pointer, leading to
unaligned access on Sparc (Thanks Lutin to report it and Debian tools/infra
to help us catch it) and also a memory leak.
2014-01-11 21:38:55 +09:00
Carsten Haitzler e8c13118eb fix mingw build for setuid fix/checks 2014-01-08 22:06:41 +09:00
Carsten Haitzler b95ef3801f setuid safeness - ensure if an app that is setuid doesn't do bad things
this makes efl ignore certain env vars for thnigs and entirely removes
user modules (that no one ever used) etc. etc. to ensure that *IF* an
app is setuid, there isn't a priv escalation path that is easy.
2014-01-08 19:46:23 +09:00
Carsten Haitzler e4b029da0b eina - eina_file - fix leak of fd is fd is 0
this should fix CID 1039181
2013-12-13 21:26:05 +09:00
Cedric Bail 62b469749a eina: fix the crash seen by some during rebuild.
Before this patch, we were unconditionnaly destroying the Eina_File if that one
did change on disk. We also make sure that we remove the right entry from the cache
if the file did change there.
2013-11-21 14:49:08 +09:00
Cedric Bail 0cfb40b7fb eina: cleanup file destruction and reintroduce EINA_MAGIC use. 2013-11-20 20:08:44 +09:00
Jérémy Zurcher 58b578c9b0 eina: fix a possible race condition during eina_file_close.
replay 7e8fb93 without the breakage
2013-11-20 10:22:00 +01:00
Jérémy Zurcher 8a3e021298 Revert "eina: fix a possible race condition during eina_file_close."
it breaks everything

This reverts commit 7e8fb93206.
2013-11-20 10:22:00 +01:00
Cedric Bail 7e8fb93206 eina: fix a possible race condition during eina_file_close.
The lock on the main hash was taken to late (after we took the decision
to remove the targeted Eina_File from the cache), this means it was possible
to get an Eina_File from the cache that was going to be removed. This patch
attempt to fix that potential race condition.

Hopefully should fix T461.
2013-11-20 13:02:37 +09:00
Cedric Bail 44f539e1a3 eina: fix eina_hash_int64 on Windows system. 2013-11-09 20:07:27 +09:00
Cedric Bail 687e4ae744 eina: roll const into Eina_File API.
Note that eina_file_dup is const from the caller perspective as it
will return a fresh "non const" Eina_File that it will be able to
manipulate as it like.
2013-11-04 11:26:59 +09:00
Cedric Bail 60a34c1cd0 eina: avoid possible race condition when unreffing an Eina_File. 2013-10-28 18:32:40 +09:00
Cedric Bail 46447c95aa eina: just for a little bit of better portability. 2013-10-16 16:54:36 +09:00
Sebastian Dransfeld 0b26b1bd89 eina: And guard the right function with umask
Thanks Cedric.
2013-10-16 04:56:51 +02:00
Sebastian Dransfeld 7576ff00f3 Set secure file permissions for temporary file
From glibc mkstemp man page:
       In glibc versions 2.06 and earlier, the file is created with
       permissions 0666, that is, read and write for all users.  This old
       behavior may be a security risk, especially since other UNIX flavors
       use 0600, and somebody might overlook this detail when porting
       programs.  POSIX.1-2008 adds a requirement that the file be created
       with mode 0600.

       More generally, the POSIX specification of mkstemp() does not say
       anything about file modes, so the application should make sure its
       file mode creation mask (see umask(2)) is set appropriately before
       calling mkstemp() (and mkostemp()).

And:
	http://cwe.mitre.org/data/definitions/377.html
2013-10-16 04:28:53 +02:00
ChunEon Park 18be4c50d9 eina/eina_file - fix eina_file_map_lines() to not drop of one character in the last line. 2013-10-04 01:58:35 +09:00
Cedric Bail d7c8d221b0 eina: forgotten lock, thanks coverity. 2013-09-03 12:58:51 +09:00
Cedric Bail 64823141f6 eina: fix typo and use the right refcount. 2013-09-02 11:16:59 +09:00
Jean-Philippe Andre deacfdce24 eina: Fix invalid check on Eina_File::global_map
global_map is set to MAP_FAILED in case of error after mmap.
So, it is initialized to MAP_FAILED and considered valid
otherwise.

So, we don't want to set the map to NULL or even check again NULL.
2013-08-27 17:31:12 +09:00
Cedric Bail d72239a118 eina: remove a warning. 2013-08-12 12:11:56 +09:00
Cedric Bail 861823848a eina: change eina_file_virtualize to be able to provide a fake name. 2013-08-09 20:50:54 +09:00
Cedric Bail c4beec0127 eina: fix compilation of Eina_File on windows. 2013-08-08 17:05:14 +09:00
Cedric Bail c90179ce86 eina: fix build on FreeBSD. 2013-08-06 15:44:22 +09:00
Chris Michael a97f3c0b9b Fix eina_file_virtual_map_new function (/me glares at Frenchie).
- Spank Cedric !!!!!

NB: How about we actually fill in "map" after allocation ??

NB: Previously we would malloc "map" and immediately exit without
filling it in, without adding it to the hash....nothing. Just allocate
and get out. Bad Frenchie !!!

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-08-05 13:01:52 +01:00
Cedric Bail 4dd259f3b1 eina: add eina_file_refresh(). 2013-07-31 17:16:40 +09:00
Cedric Bail f2de8970a1 eina: add support for in memory only Eina_File. 2013-07-31 11:51:51 +09:00
Chris Michael a144495daa Initialize 'd' to -1 so we can check on 'end' if it needs closing
Signed-off-by: Chris Michael <devilhorns@comcast.net>
2013-07-08 16:05:12 +01:00
Chris Michael 2aa12782b6 If we open a file for copying, then we should also Close that file
when the copy is done.

NB: Fixes Coverity CID1039181

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-07-08 11:13:56 +01:00
Sebastian Dransfeld 336f6ec328 efl: formatting 2013-06-20 13:28:18 +02:00
Cedric Bail 06cd16548c eina: add eina_file_dup. 2013-06-04 15:04:19 +09:00
Cedric Bail 574e9015f1 eina: whitespace--; 2013-05-08 18:17:00 +09:00
Cedric Bail 5da94cfc89 eina: add <errno.h> for build on Win32. 2013-03-30 18:20:19 +09:00
Vladislav Brovko 7584a7e84d eina: add eina_file_mkdtemp and tests for Eina_File.
Test added for :
eina_file_direct_ls_simple
eina_file_ls_simple

Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
2013-03-27 22:45:34 +09:00
Cedric BAIL 70f8bd50eb eina: add eina_file_mkstemp. 2013-03-25 18:45:42 +09:00
Cedric BAIL 6b4ba5cead eina: a little bit sleepy, put that in the right file. 2013-03-15 16:47:05 +09:00
Cedric BAIL 0dde9a6574 eina: share eina_file_copy code accross platform. 2013-03-15 16:05:39 +09:00
Cedric BAIL e70502f1a1 eina: improve portability of Eina_File. 2013-03-15 11:05:25 +09:00
Daniel Willmann f90726cf35 Revert "eina: improve portability of Eina_File."
This reverts commit c002d113f1.

This commit reliably breaks builds with clang. Please test with
export CC=clang before you commit again.

export CC=clang
./autogen.sh --enable-multisense && make -j 10

The error Jenkins gets (I confirmed locally):

/bin/bash: line 1: 13549 Segmentation fault      (core dumped) EFL_RUN_IN_TREE=1 ./bin/edje/edje_cc -id . -fd . -id ./tests/emotion/data tests/emotion/data/theme.edc tests/emotion/data/theme.edj
2013-03-14 17:21:48 +00:00
Cedric BAIL c002d113f1 eina: improve portability of Eina_File. 2013-03-14 20:52:37 +09:00