Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conman fails when timezone is greater than 4 characters. #16

Closed
GoogleCodeExporter opened this issue Mar 17, 2015 · 7 comments
Closed
Labels
Milestone

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

/usr/share/zoneinfo/Etc/GMT-1 used for /etc/localtime

What is the expected output? What do you see instead?

expected conman deamon to function, instead saw the log message;

NOTICE: Starting ConMan daemon 0.2.5 (pid 86513)
INFO: Open file limit set to 1024
ERROR: strftime() failed

NB: same problem with 0.2.7

What version of the software are you using? On what operating system?

conman 0.2.5-2.4.el6 as shipped with SL6.3. Noticed same problem in source tip of tree.

Please provide any additional information below.

The problem is create_long_time_string(time_t t) has const int len set to 25, when it should be 29 (or higher) to deal with all known current timezone codes. Recommend it be set to 32 to provide an engineering margin.

in util_str.c:

char * create_long_time_string(time_t t)
{
    char *p;
    struct tm tm;
    const int len = 25;                 /* YYYY-MM-DD HH:MM:SS ZONE + NUL */

    if (!(p = malloc(len))) {
        out_of_memory();
    }
    get_localtime(&t, &tm);

    if (strftime(p, len, "%Y-%m-%d %H:%M:%S %Z", &tm) == 0) {
        log_err(0, "strftime() failed");
    }
    return(p);
}

Original issue reported on code.google.com by mark_salyzyn@xyratex.com on 3 Jan 2013 at 8:54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants