~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/errmsg_print.cc

  • Committer: Brian Aker
  • Date: 2010-11-22 00:16:44 UTC
  • mto: (1945.2.1 quick)
  • mto: This revision was merged to the branch mainline in revision 1947.
  • Revision ID: brian@tangent.org-20101122001644-pi6jv0d65e82xn38
Merge in lock refactor, this just encapsulates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
*/
24
24
 
25
25
#include "config.h"
26
 
#include <drizzled/plugin/registry.h>
 
26
 
 
27
#include <drizzled/definitions.h>
27
28
#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
 
  // is stderr threadsafe?
40
 
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s", message, strerror(errno));
 
39
  char errmsg[STRERROR_MAX];
 
40
  strerror_r(errno, errmsg, sizeof(errmsg));
 
41
  errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s\n", message, errmsg);
41
42
}
42
43
 
43
44
bool errmsg_printf (int priority, char const *format, ...)
45
46
  bool rv;
46
47
  va_list args;
47
48
  va_start(args, format);
48
 
  rv= plugin::ErrorMessage::vprintf(current_session, priority, format, args);
 
49
  rv= plugin::ErrorMessage::vprintf(NULL, priority, format, args);
49
50
  va_end(args);
50
51
  return rv;
51
52
}