}
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.
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) {