示例#1
0
文件: berrno.c 项目: barroque/burp
const char *berrno::bstrerror()
{
   *m_buf = 0;
#ifdef HAVE_WIN32
//   if (m_berrno & b_errno_win32) {
      format_win32_message();
      return (const char *)m_buf;
//   }
#endif
   /* Normal errno */
   if (b_strerror(m_berrno, m_buf, sizeof(m_buf)) < 0) {
      return _("Invalid errno. No error message possible.");
   }
   return m_buf;
}
示例#2
0
文件: berrno.c 项目: AlD/bareos
const char *berrno::bstrerror()
{
   *m_buf = 0;
#ifdef HAVE_WIN32
   if (m_berrno & b_errno_win32) {
      format_win32_message();
      return (const char *)m_buf;
   }
#else
   int status = 0;

   if (m_berrno & b_errno_exit) {
      status = (m_berrno & ~b_errno_exit);      /* remove bit */
      if (status == 0) {
         return _("Child exited normally.");    /* this really shouldn't happen */
      } else {
         /* Maybe an execvp failure */
         if (status >= 200) {
            if (status < 200 + num_execvp_errors) {
               m_berrno = execvp_errors[status - 200];
            } else {
               return _("Unknown error during program execvp");
            }
         } else {
            Mmsg(m_buf, _("Child exited with code %d"), status);
            return m_buf;
         }
         /* If we drop out here, m_berrno is set to an execvp errno */
      }
   }
   if (m_berrno & b_errno_signal) {
      status = (m_berrno & ~b_errno_signal);        /* remove bit */
      Mmsg(m_buf, _("Child died from signal %d: %s"), status, get_signal_name(status));
      return m_buf;
   }
#endif
   /* Normal errno */
   if (b_strerror(m_berrno, m_buf, 1024) < 0) {
      return _("Invalid errno. No error message possible.");
   }
   return m_buf;
}