summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/rtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/rtc.c')
-rw-r--r--firmware/target/hosted/rtc.c12
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)
62 tm_time = gmtime(&now); 62 tm_time = gmtime(&now);
63 63
64 /* Try to write the HW RTC, if present. */ 64 /* Try to write the HW RTC, if present. */
65 int rtc = open("/dev/rtc0", O_WRONLY); 65 int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
66 if (rtc > 0) { 66 if (rtc > 0) {
67 ioctl(rtc, RTC_SET_TIME, (struct rtc_time *)tm_time); 67 ioctl(rtc, RTC_SET_TIME, (struct rtc_time *)tm_time);
68 close(rtc); 68 close(rtc);
@@ -79,7 +79,7 @@ void rtc_set_alarm(int h, int m)
79 struct rtc_time tm; 79 struct rtc_time tm;
80 long sec; 80 long sec;
81 81
82 int rtc = open("/dev/rtc0", O_WRONLY); 82 int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
83 if (rtc < 0) 83 if (rtc < 0)
84 return; 84 return;
85 85
@@ -124,7 +124,7 @@ void rtc_get_alarm(int *h, int *m)
124 struct rtc_time tm; 124 struct rtc_time tm;
125 long sec; 125 long sec;
126 126
127 int rtc = open("/dev/rtc0", O_WRONLY); 127 int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
128 if (rtc < 0) 128 if (rtc < 0)
129 return; 129 return;
130 130
@@ -157,7 +157,7 @@ void rtc_get_alarm(int *h, int *m)
157 157
158void rtc_enable_alarm(bool enable) 158void rtc_enable_alarm(bool enable)
159{ 159{
160 int rtc = open("/dev/rtc0", O_WRONLY); 160 int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
161 if (rtc < 0) 161 if (rtc < 0)
162 return; 162 return;
163 163
@@ -171,7 +171,7 @@ void rtc_enable_alarm(bool enable)
171/* Returns true if alarm was the reason we started up */ 171/* Returns true if alarm was the reason we started up */
172bool rtc_check_alarm_started(bool release_alarm) 172bool rtc_check_alarm_started(bool release_alarm)
173{ 173{
174 int rtc = open("/dev/rtc0", O_WRONLY); 174 int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
175 if (rtc < 0) 175 if (rtc < 0)
176 return false; 176 return false;
177 177
@@ -191,7 +191,7 @@ bool rtc_check_alarm_flag(void)
191{ 191{
192 struct rtc_wkalrm alrm; 192 struct rtc_wkalrm alrm;
193 193
194 int rtc = open("/dev/rtc0", O_WRONLY); 194 int rtc = open("/dev/rtc0", O_WRONLY | O_CLOEXEC);
195 if (rtc < 0) 195 if (rtc < 0)
196 return false; 196 return false;
197 197