monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[monit-dev] [monit] r377 committed - vLogError


From: monit
Subject: [monit-dev] [monit] r377 committed - vLogError
Date: Thu, 09 Jun 2011 12:56:31 +0000

Revision: 377
Author:   address@hidden
Date:     Thu Jun  9 05:56:06 2011
Log:      vLogError

http://code.google.com/p/monit/source/detail?r=377

Modified:
 /trunk/log.c
 /trunk/monitor.h
 /trunk/net.c

=======================================
--- /trunk/log.c        Mon May 30 06:02:52 2011
+++ /trunk/log.c        Thu Jun  9 05:56:06 2011
@@ -220,6 +220,20 @@
   va_end(ap);
   log_backtrace();
 }
+
+
+/**
+ * Logging interface with priority support
+ * @param s A formated (printf-style) string to log
+ */
+void vLogError(const char *s, va_list ap) {
+  va_list ap_copy;
+  ASSERT(s);
+  va_copy(ap_copy, ap);
+  log_log(LOG_ERR, s, ap);
+  va_end(ap_copy);
+  log_backtrace();
+}


 /**
=======================================
--- /trunk/monitor.h    Wed Jun  8 06:21:51 2011
+++ /trunk/monitor.h    Thu Jun  9 05:56:06 2011
@@ -924,6 +924,7 @@
 void  LogAlert(const char *, ...);
 void  LogCritical(const char *, ...);
 void  LogError(const char *, ...);
+void  vLogError(const char *s, va_list ap);
 void  LogWarning(const char *, ...);
 void  LogNotice(const char *, ...);
 void  LogInfo(const char *, ...);
=======================================
--- /trunk/net.c        Wed Jan 19 10:40:32 2011
+++ /trunk/net.c        Thu Jun  9 05:56:06 2011
@@ -799,7 +799,7 @@
* Do a non blocking connect, timeout if not connected within timeout seconds
  */
static int do_connect(int s, const struct sockaddr *addr, socklen_t addrlen, int timeout) {
-  int error;
+  int error = 0;
   struct pollfd fds[1];

   switch (connect(s, addr, addrlen)) {
@@ -813,6 +813,7 @@
   fds[0].fd = s;
   fds[0].events = POLLIN|POLLOUT;
   if (poll(fds, 1, timeout * 1000) == 0) {
+    close(s);
     errno = ETIMEDOUT;
     return -1;
   }
@@ -824,6 +825,7 @@
     return -1;
   }
   if (error) {
+    close(s);
     errno = error;
     return -1;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]