summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/sysfs.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-11 01:27:20 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-11 01:47:03 -0400
commit5cfd3ae4e65e8f12887de7374dd6591449d9454c (patch)
treed547270bdd3b843dea917d4b2579c50303a4d3a4 /firmware/target/hosted/sysfs.c
parent4f8736909a92b0fcf6be25793791625c243061d1 (diff)
downloadrockbox-5cfd3ae4e65e8f12887de7374dd6591449d9454c.tar.gz
rockbox-5cfd3ae4e65e8f12887de7374dd6591449d9454c.zip
hosted: Use O_CLOEXEC for all open() and "e" for fopen() calls
This way we'll automatically close the files upon exec() Change-Id: Ic0daca8fb56432830de4a2f4a86a77337121ecc7
Diffstat (limited to 'firmware/target/hosted/sysfs.c')
-rw-r--r--firmware/target/hosted/sysfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/target/hosted/sysfs.c b/firmware/target/hosted/sysfs.c
index 177f338911..1c3fe8c396 100644
--- a/firmware/target/hosted/sysfs.c
+++ b/firmware/target/hosted/sysfs.c
@@ -32,7 +32,7 @@
32 32
33static FILE* open_read(const char *file_name) 33static FILE* open_read(const char *file_name)
34{ 34{
35 FILE *f = fopen(file_name, "r"); 35 FILE *f = fopen(file_name, "re");
36 if(f == NULL) 36 if(f == NULL)
37 { 37 {
38 DEBUGF("ERROR %s: Can not open %s for reading.", __func__, file_name); 38 DEBUGF("ERROR %s: Can not open %s for reading.", __func__, file_name);
@@ -44,7 +44,7 @@ static FILE* open_read(const char *file_name)
44 44
45static FILE* open_write(const char* file_name) 45static FILE* open_write(const char* file_name)
46{ 46{
47 FILE *f = fopen(file_name, "w"); 47 FILE *f = fopen(file_name, "we");
48 if(f == NULL) 48 if(f == NULL)
49 { 49 {
50 DEBUGF("ERROR %s: Can not open %s for writing.", __func__, file_name); 50 DEBUGF("ERROR %s: Can not open %s for writing.", __func__, file_name);