chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bcb161b
)
hwclock: use _cleanup_ to simplify function
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Thu, 11 Apr 2013 23:02:37 +0000
(19:02 -0400)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Thu, 11 Apr 2013 23:13:18 +0000
(19:13 -0400)
src/shared/hwclock.c
patch
|
blob
|
history
diff --git
a/src/shared/hwclock.c
b/src/shared/hwclock.c
index 55b0fa8a0f1c855ade2f9ee26bbc141aaf1f6cf2..9076d8ffc76b850e20d280d876b6c241e86c8074 100644
(file)
--- a/
src/shared/hwclock.c
+++ b/
src/shared/hwclock.c
@@
-163,8
+163,7
@@
int hwclock_set_time(const struct tm *tm) {
}
int hwclock_is_localtime(void) {
- FILE *f;
- bool local = false;
+ FILE _cleanup_fclose_ *f;
/*
* The third line of adjtime is "UTC" or "LOCAL" or nothing.
@@
-181,19
+180,16
@@
int hwclock_is_localtime(void) {
b = fgets(line, sizeof(line), f) &&
fgets(line, sizeof(line), f) &&
fgets(line, sizeof(line), f);
-
- fclose(f);
-
if (!b)
return -EIO;
truncate_nl(line);
-
local =
streq(line, "LOCAL");
+
return
streq(line, "LOCAL");
} else if (errno != ENOENT)
return -errno;
- return
local
;
+ return
0
;
}
int hwclock_set_timezone(int *min) {