/*
- * $Id: cnid_metad.c,v 1.1.4.12 2004-02-07 19:46:08 didg Exp $
+ * $Id: cnid_metad.c,v 1.1.4.15 2004-09-06 07:19:21 didg Exp $
*
* Copyright (C) Joerg Lenneis 2003
* All Rights Reserved. See COPYING.
struct iovec iov[1];
struct cmsghdr *cmsgp = NULL;
char *buf;
+ size_t size;
int er=0;
- buf = malloc(CMSG_SPACE(sizeof fd));
+ size = CMSG_SPACE(sizeof fd);
+ buf = malloc(size);
+ if (!buf) {
+ LOG(log_error, logtype_cnid, "error in sendmsg: %s", strerror(errno));
+ return -1;
+ }
memset(&msgh,0,sizeof (msgh));
- memset(buf,0,sizeof (buf));
+ memset(buf,0, size);
msgh.msg_name = NULL;
msgh.msg_namelen = 0;
iov[0].iov_len = sizeof(er);
msgh.msg_control = buf;
- msgh.msg_controllen = sizeof(buf);
+ msgh.msg_controllen = size;
cmsgp = CMSG_FIRSTHDR(&msgh);
cmsgp->cmsg_level = SOL_SOCKET;
int status;
char *dbdpn = _PATH_CNID_DBD;
char *host = DEFAULTHOST;
- int port = DEFAULTPORT;
+ u_int16_t port = DEFAULTPORT;
struct db_param *dbp;
int i;
int cc;
int err = 0;
int debug = 0;
int ret;
+
+ set_processname("cnid_metad");
while (( cc = getopt( argc, argv, "ds:p:h:u:g:")) != -1 ) {
switch (cc) {