~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/errmsg_stderr/errmsg_stderr.cc

  • Committer: Andrew Hutchings
  • Date: 2011-01-28 21:33:48 UTC
  • mto: (2126.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2127.
  • Revision ID: andrew@linuxjedi.co.uk-20110128213348-ypi381xo47o80ypo
Backport fix for http://bugs.mysql.com/bug.php?id=57034

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include <config.h>
 
20
#include "config.h"
21
21
#include <drizzled/plugin/error_message.h>
22
22
#include <drizzled/gettext.h>
23
23
#include <drizzled/plugin.h>
36
36
public:
37
37
  Error_message_stderr()
38
38
   : plugin::ErrorMessage("Error_message_stderr") {}
39
 
  virtual bool errmsg(error::level_t , const char *format, va_list ap)
 
39
  virtual bool errmsg(Session *, int , const char *format, va_list ap)
40
40
  {
41
41
    char msgbuf[MAX_MSG_LEN];
42
42
    int prv, wrv;
47
47
    /* a single write has a OS level thread lock
48
48
       so there is no need to have mutexes guarding this write,
49
49
    */
50
 
    wrv= write(fileno(stderr), msgbuf, prv);
51
 
    fputc('\n', stderr);
52
 
    if ((wrv < 0) || (wrv != prv))
53
 
      return true;
 
50
    wrv= write(2, msgbuf, prv);
 
51
    if ((wrv < 0) || (wrv != prv)) return true;
54
52
 
55
53
    return false;
56
54
  }