Commit d0335779 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Pavel Emelyanov

test_msg(): avoid recursion

In (highly unlikely) case localtime() failed, test_msg() calls
pr_perror() which is a wrapper around test_msg() so we're
calling ourselves, which can lead to infinite recursion if
localtime() keeps failing. Use fprintf() here to avoid this.
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Acked-by: 's avatarAndrew Vagin <avagin@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ae6294f4
...@@ -50,7 +50,8 @@ void test_msg(const char *format, ...) ...@@ -50,7 +50,8 @@ void test_msg(const char *format, ...)
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
tm = localtime(&tv.tv_sec); tm = localtime(&tv.tv_sec);
if (tm == NULL) { if (tm == NULL) {
pr_perror("localtime() failed"); fprintf(stderr, "ERROR in %s: localtime() failed: %m\n",
__func__);
} else { } else {
off += strftime(buf, sizeof(buf), "%H:%M:%S", tm); off += strftime(buf, sizeof(buf), "%H:%M:%S", tm);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment