The logger and rtwake time function changes continue the same fixes as
previous commit - use thread safe functions. The libsmartcols condition
removal is possible because width must be greater than tb->termwidth that is
size_t and cannot be smaller than zero. And remove couple FIXME's that are
old and unlikely ever to get fixed.
Reference:
3160589d86470ce7d20c81090fb7f211b3822053
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
return cells;
}
-/* FIXME: move this function to gnulib as it's missing on:
- OpenBSD 3.8, IRIX 5.3, Solaris 2.5.1, mingw, BeOS */
-
static int
rpl_wcswidth (const wchar_t *s, size_t n)
{
static char*
mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces, int padchar)
{
- /* FIXME: Should we pad with "figure space" (\u2007)
- if non ascii data present? */
for (/* nothing */; n_spaces && (dest < dest_end); n_spaces--)
*dest++ = padchar;
*dest = '\0';
return 1;
}
-/*
- * Extract a tag of the form <NAME>value</NAME> from the line.
- */
-/*
-static int parse_xml(char **name, char **value, char **cp)
-{
- char *end;
-
- if (!name || !value || !cp)
- return -BLKID_ERR_PARAM;
-
- *name = strip_line(*cp);
-
- if ((*name)[0] != '<' || (*name)[1] == '/')
- return 0;
-
- FIXME: finish this.
-}
-*/
-
/*
* Extract a tag from the line.
*
if (!cache || !dev)
return -BLKID_ERR_PARAM;
- if ((ret = parse_token(&name, &value, cp)) <= 0 /* &&
- (ret = parse_xml(&name, &value, cp)) <= 0 */)
+ if ((ret = parse_token(&name, &value, cp)) <= 0)
return ret;
DBG(READ, ul_debug("tag: %s=\"%s\"", name, value));
continue;
/* nothing to truncate */
- if (cl->width == 0 || width == 0)
+ if (cl->width == 0)
continue;
trunc_flag = scols_column_is_trunc(cl)
if (ctl->rfc5424_time) {
struct timeval tv;
- struct tm *tm;
+ struct tm tm;
logger_gettimeofday(&tv, NULL);
- if ((tm = localtime(&tv.tv_sec)) != NULL) {
+ if (localtime_r(&tv.tv_sec, &tm) != NULL) {
char fmt[64];
const size_t i = strftime(fmt, sizeof(fmt),
- "%Y-%m-%dT%H:%M:%S.%%06u%z ", tm);
+ "%Y-%m-%dT%H:%M:%S.%%06u%z ", &tm);
/* patch TZ info to comply with RFC3339 (we left SP at end) */
fmt[i - 1] = fmt[i - 2];
fmt[i - 2] = fmt[i - 3];
printf("\tdelta = %ld\n", ctl->sys_time - ctl->rtc_time);
printf("\ttzone = %ld\n", timezone);
printf("\ttzname = %s\n", tzname[daylight]);
- gmtime_r(&ctl->rtc_time, &tm);
+ gmtime_r(&ctl->sys_time, &tm);
printf("\tsystime = %ld, (UTC) %s",
- (long) ctl->sys_time, asctime_r(gmtime(&ctl->sys_time), s));
+ (long) ctl->sys_time, asctime_r(&tm, s));
+ gmtime_r(&ctl->rtc_time, &tm);
printf("\trtctime = %ld, (UTC) %s",
(long) ctl->rtc_time, asctime_r(&tm, s));
}