diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-10-11 01:27:20 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-11 01:47:03 -0400 |
commit | 5cfd3ae4e65e8f12887de7374dd6591449d9454c (patch) | |
tree | d547270bdd3b843dea917d4b2579c50303a4d3a4 /firmware/target/hosted/rtc.c | |
parent | 4f8736909a92b0fcf6be25793791625c243061d1 (diff) | |
download | rockbox-5cfd3ae4e6.tar.gz rockbox-5cfd3ae4e6.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/rtc.c')
-rw-r--r-- | firmware/target/hosted/rtc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/firmware/target/hosted/rtc.c b/firmware/target/hosted/rtc.c index ced298a5c8..e747aece38 100644 --- a/firmware/target/hosted/rtc.c +++ b/firmware/target/hosted/rtc.c @@ -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; |