Commit 41d9e7a
committed
plugins:rtc.c: drop some invalid condition checks
There are some invalid condition checks in rtc.c, when rtc_file is
missing, it should not consider that as a error and return, otherwise,
it can lead to the case that time_set wont be called at all.
With this fix, when both RTC and file restore fail, it will fall back
to call time_set(NULL) and restore time from rtc_timestamp, this
ensures the OS has a valid time at the very first boot.
Also explicitly check strptime return value against "NULL" rather than
using "!", which is not always accurate.
Signed-off-by: Ming Liu <liu.ming50@gmail.com>1 parent 6f6267f commit 41d9e7a
1 file changed
+2
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | 176 | | |
182 | 177 | | |
183 | 178 | | |
| |||
292 | 287 | | |
293 | 288 | | |
294 | 289 | | |
295 | | - | |
296 | | - | |
| 290 | + | |
297 | 291 | | |
298 | 292 | | |
299 | 293 | | |
| |||
327 | 321 | | |
328 | 322 | | |
329 | 323 | | |
330 | | - | |
| 324 | + | |
331 | 325 | | |
332 | 326 | | |
333 | 327 | | |
| |||
0 commit comments