#include "rrdd.h"
#include "rrdc.h"
-#define SOCK_TEMPLATE "/tmp/rrdc.sock.XXXXXX"
-
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
static int sd;
static FILE *sh;
if (sh == NULL)
{
pthread_mutex_unlock (&lock);
- return (-1);
+ return (ENOTCONN);
}
status = write (sd, buffer, sizeof (buffer) - buffer_size);
+ status = read (sd, buffer, sizeof (buffer));
+ if (status < 0)
+ {
+ status = errno;
+ pthread_mutex_unlock (&lock);
+ return (status);
+ }
+ else if (status == 0)
+ {
+ pthread_mutex_unlock (&lock);
+ return (ENODATA);
+ }
+
+ status = atoi (buffer);
+
pthread_mutex_unlock (&lock);
- return (0);
+ return (status);
} /* int rrd_update_daemon */
/*