~mordred/gearmand/cancel-job

« back to all changes in this revision

Viewing changes to libtest/fatal.cc

  • Committer: Brian Aker
  • Date: 2012-05-04 03:46:04 UTC
  • Revision ID: brian@tangent.org-20120504034604-5t22ae4v2o45zjkq
Update for libtest, documentation, and fix for root bzr dir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
namespace libtest {
42
42
 
43
 
fatal::fatal(const char *file, int line, const char *func, const char *format, ...) :
44
 
  std::runtime_error(func)
 
43
fatal::fatal(const char *file_arg, int line_arg, const char *func_arg, const char *format, ...) :
 
44
  std::runtime_error(func_arg),
 
45
  _file(file_arg),
 
46
  _line(line_arg),
 
47
  _func(func_arg)
45
48
  {
46
49
    va_list args;
47
50
    va_start(args, format);
48
51
    char last_error[BUFSIZ];
49
 
    (void)vsnprintf(last_error, sizeof(last_error), format, args);
 
52
    int last_error_length= vsnprintf(last_error, sizeof(last_error), format, args);
50
53
    va_end(args);
51
54
 
52
 
    snprintf(_error_message, sizeof(_error_message), "%s:%d FATAL:%s (%s)", file, int(line), last_error, func);
 
55
    strncpy(_mesg, last_error, sizeof(_mesg));
 
56
 
 
57
    snprintf(_error_message, sizeof(_error_message), "%s:%d FATAL:%s (%s)", _file, int(_line), last_error, _func);
53
58
  }
54
59
 
55
60
static bool _disabled= false;