- if (str && sscanf(str, "%ju.%ju", &sec, &usec) == 2) {
+ if (str) {
+ if (sscanf(str, "%ju.%ju", &sec, &usec) != 2)
+ goto err;
+
errx(EXIT_FAILURE, _("openlog %s: pathname too long"), path);
s_addr.sun_family = AF_UNIX;
errx(EXIT_FAILURE, _("openlog %s: pathname too long"), path);
s_addr.sun_family = AF_UNIX;
int n, lines = 0, vectors = 8, ret = 0, msgline = -1;
size_t dummy = 0;
int n, lines = 0, vectors = 8, ret = 0, msgline = -1;
size_t dummy = 0;
static char const * const monthnames[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
};
static char const * const monthnames[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
};
- logger_gettimeofday(&tv, NULL);
+ ret = logger_gettimeofday(&tv, NULL);
+ if (ret == -1)
+ err(EXIT_FAILURE, _("gettimeofday() failed"));
localtime_r(&tv.tv_sec, &tm);
snprintf(time, sizeof(time),"%s %2d %2.2d:%2.2d:%2.2d",
monthnames[tm.tm_mon], tm.tm_mday,
localtime_r(&tv.tv_sec, &tm);
snprintf(time, sizeof(time),"%s %2d %2.2d:%2.2d:%2.2d",
monthnames[tm.tm_mon], tm.tm_mday,
if (ctl->octet_count) {
size_t len = xasprintf(&octet, "%zu ", strlen(ctl->hdr) + strlen(msg));
iovec_add_string(iov, iovlen, octet, len);
if (ctl->octet_count) {
size_t len = xasprintf(&octet, "%zu ", strlen(ctl->hdr) + strlen(msg));
iovec_add_string(iov, iovlen, octet, len);
- logger_gettimeofday(&tv, NULL);
+ ret = logger_gettimeofday(&tv, NULL);
+ if (ret == -1)
+ err(EXIT_FAILURE, _("gettimeofday() failed"));
if (localtime_r(&tv.tv_sec, &tm) != NULL) {
char fmt[64];
const size_t i = strftime(fmt, sizeof(fmt),
if (localtime_r(&tv.tv_sec, &tm) != NULL) {
char fmt[64];
const size_t i = strftime(fmt, sizeof(fmt),
- printf(USAGE_HELP_OPTIONS(26));
- printf(USAGE_MAN_TAIL("logger(1)"));
+ fprintf(out, USAGE_HELP_OPTIONS(26));
+ fprintf(out, USAGE_MAN_TAIL("logger(1)"));