~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/errmsg_print.cc

  • Committer: Brian Aker
  • Date: 2010-06-02 23:40:24 UTC
  • mto: (1578.6.9 explain-drizzle)
  • mto: This revision was merged to the branch mainline in revision 1585.
  • Revision ID: brian@gir-2.local-20100602234024-x26qr3pfhvood1d7
keys and fields partial encapsulation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
#include "config.h"
26
26
 
27
 
#include <drizzled/definitions.h>
28
27
#include <drizzled/errmsg_print.h>
 
28
#include <drizzled/current_session.h>
29
29
#include <drizzled/plugin/error_message.h>
30
30
 
31
31
#include <cerrno>
36
36
 
37
37
void sql_perror(const char *message)
38
38
{
39
 
  char errmsg[STRERROR_MAX];
40
 
  strerror_r(errno, errmsg, sizeof(errmsg));
41
 
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s\n", message, errmsg);
 
39
  // is stderr threadsafe?
 
40
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s", message, strerror(errno));
42
41
}
43
42
 
44
43
bool errmsg_printf (int priority, char const *format, ...)
46
45
  bool rv;
47
46
  va_list args;
48
47
  va_start(args, format);
49
 
  rv= plugin::ErrorMessage::vprintf(NULL, priority, format, args);
 
48
  rv= plugin::ErrorMessage::vprintf(current_session, priority, format, args);
50
49
  va_end(args);
51
50
  return rv;
52
51
}