forked from len0rd/rockbox
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
This commit is contained in:
parent
4f8736909a
commit
5cfd3ae4e6
14 changed files with 27 additions and 31 deletions
|
@ -62,7 +62,7 @@ int rtc_write_datetime(const struct tm *tm)
|
|||
tm_time = gmtime(&now);
|
||||
|
||||
/* Try to write the HW RTC, if present. */
|
||||
int rtc = open("/dev/rtc0", O_WRONLY);
|
||||
int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
|
||||
if (rtc > 0) {
|
||||
ioctl(rtc, RTC_SET_TIME, (struct rtc_time *)tm_time);
|
||||
close(rtc);
|
||||
|
@ -79,7 +79,7 @@ void rtc_set_alarm(int h, int m)
|
|||
struct rtc_time tm;
|
||||
long sec;
|
||||
|
||||
int rtc = open("/dev/rtc0", O_WRONLY);
|
||||
int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
|
||||
if (rtc < 0)
|
||||
return;
|
||||
|
||||
|
@ -124,7 +124,7 @@ void rtc_get_alarm(int *h, int *m)
|
|||
struct rtc_time tm;
|
||||
long sec;
|
||||
|
||||
int rtc = open("/dev/rtc0", O_WRONLY);
|
||||
int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
|
||||
if (rtc < 0)
|
||||
return;
|
||||
|
||||
|
@ -157,7 +157,7 @@ void rtc_get_alarm(int *h, int *m)
|
|||
|
||||
void rtc_enable_alarm(bool enable)
|
||||
{
|
||||
int rtc = open("/dev/rtc0", O_WRONLY);
|
||||
int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
|
||||
if (rtc < 0)
|
||||
return;
|
||||
|
||||
|
@ -171,7 +171,7 @@ void rtc_enable_alarm(bool enable)
|
|||
/* Returns true if alarm was the reason we started up */
|
||||
bool rtc_check_alarm_started(bool release_alarm)
|
||||
{
|
||||
int rtc = open("/dev/rtc0", O_WRONLY);
|
||||
int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
|
||||
if (rtc < 0)
|
||||
return false;
|
||||
|
||||
|
@ -191,7 +191,7 @@ bool rtc_check_alarm_flag(void)
|
|||
{
|
||||
struct rtc_wkalrm alrm;
|
||||
|
||||
int rtc = open("/dev/rtc0", O_WRONLY);
|
||||
int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
|
||||
if (rtc < 0)
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue