+ r = readlink_malloc("/etc/localtime", &t);
+ if (r < 0) {
+ if (r == -EINVAL)
+ log_warning("/etc/localtime should be a symbolic link to a timezone data file in " ZONEINFO_PATH);
+ else
+ log_warning("Failed to get target of %s: %s", "/etc/localtime", strerror(-r));
+ } else {
+ /* we only support the trivial relative link of (/etc/)..$ABSOLUTE */
+ int rel_link_offset = startswith(t, "..") ? strlen("..") : 0;
+
+ if (!startswith(t + rel_link_offset, ZONEINFO_PATH))
+ log_warning("/etc/localtime should be a symbolic link to a timezone data file in " ZONEINFO_PATH);
+ else {
+ tz.zone = strdup(t + rel_link_offset + strlen(ZONEINFO_PATH));
+ free(t);
+ if (!tz.zone)
+ return log_oom();
+
+ goto have_timezone;
+ }
+ }
+
+ free(t);
+