X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fcnid_dbd%2Fcomm.c;h=28fab0e47b7a79d9b6315fc1e17e7063c0b09083;hb=f254fd618b53e97cc5382b23709d4f3de1e70b41;hp=ddbc9855294e72b511f1042566666d71f8dafc7c;hpb=f1ddfb5e36c7b6a1e88da2de25598c833c6e9dbb;p=netatalk.git diff --git a/etc/cnid_dbd/comm.c b/etc/cnid_dbd/comm.c index ddbc9855..28fab0e4 100644 --- a/etc/cnid_dbd/comm.c +++ b/etc/cnid_dbd/comm.c @@ -9,19 +9,7 @@ #include "config.h" #endif -#ifndef _XOPEN_SOURCE -# define _XOPEN_SOURCE 600 -#endif -#ifndef __EXTENSIONS__ -# define __EXTENSIONS__ -#endif -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif -#ifndef __BSD_VISIBLE -/* for u_short, u_char, etc. */ -# define __BSD_VISIBLE 1 -#endif +#include #include #include @@ -39,7 +27,8 @@ #include #include -#include +#include +#include #include "db_param.h" #include "usockfd.h" @@ -222,7 +211,7 @@ int comm_rcv(struct cnid_dbd_rqst *rqst, time_t timeout, const sigset_t *sigmask return -1; } - nametmp = rqst->name; + nametmp = (char *)rqst->name; if ((b = readt(cur_fd, rqst, sizeof(struct cnid_dbd_rqst), 1, CNID_DBD_TIMEOUT)) != sizeof(struct cnid_dbd_rqst)) { if (b) @@ -232,7 +221,7 @@ int comm_rcv(struct cnid_dbd_rqst *rqst, time_t timeout, const sigset_t *sigmask return 0; } rqst->name = nametmp; - if (rqst->namelen && readt(cur_fd, rqst->name, rqst->namelen, 1, CNID_DBD_TIMEOUT) + if (rqst->namelen && readt(cur_fd, (char *)rqst->name, rqst->namelen, 1, CNID_DBD_TIMEOUT) != rqst->namelen) { LOG(log_error, logtype_cnid, "error reading message name: %s", strerror(errno)); invalidate_fd(cur_fd); @@ -240,7 +229,7 @@ int comm_rcv(struct cnid_dbd_rqst *rqst, time_t timeout, const sigset_t *sigmask } /* We set this to make life easier for logging. None of the other stuff needs zero terminated strings. */ - rqst->name[rqst->namelen] = '\0'; + ((char *)(rqst->name))[rqst->namelen] = '\0'; LOG(log_maxdebug, logtype_cnid, "comm_rcv: got %u bytes", b + rqst->namelen);