please help with: warning: initialization makes integer from pointer
Andreas Klemm
andreas at klemm.apsfilter.org
Thu Oct 7 10:45:09 PDT 2004
Dear FreeBSD hackers,
could somebody please help Jonathan, the dspam owner, how to code
this best under FreeBSD ?
Please see his question below:
On Thu, Oct 07, 2004 at 01:16:17PM -0400, Jonathan A. Zdziarski wrote:
> I'm a little concerned about these warnings:
>
> pgsql_drv.c:873: warning: initialization makes integer from pointer
> without a cast
> pgsql_drv.c:874: warning: initialization makes integer from pointer
> without a cast
>
> This could cause some problems with dspam. Is there a freeBSDish way to
> do this:
>
> s->p_getpwnam = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL };
> s->p_getpwuid = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL };
>
> Perhaps memset(s->p_getpwnam, 0, sizeof(struct passwd)) ?
>
>
> >make all-recursive
> >Making all in .
> >[...]
> > gcc -DHAVE_CONFIG_H -DLOGDIR=\"/var/mail/dspam\"
> > -DCONFIG_DEFAULT=\"/etc/dspam.conf\" -D_REENTRANT
> > -D_POSIX_PTHREAD_SEMANTICS -I. -I. -I. -I/usr/local/include -g -O2 -Wall
> > -Wmissing-prototypes -Wmissing-declarations -MT pgsql_drv.lo -MD -MP -MF
> > .deps/pgsql_drv.Tpo -c pgsql_drv.c -fPIC -DPIC -o .libs/pgsql_drv.o
> >pgsql_drv.c: In function `_ds_init_storage':
> >pgsql_drv.c:873: warning: initialization makes integer from pointer
> >without a cast
> >pgsql_drv.c:874: warning: initialization makes integer from pointer
> >without a cast
> >pgsql_drv.c: In function `_ds_create_signature_id':
> >pgsql_drv.c:1028: warning: long unsigned int format, time_t arg (arg 4)
> >pgsql_drv.c:1028: warning: long unsigned int format, time_t arg (arg 4)
> >[...]
int
_ds_init_storage (DSPAM_CTX * CTX, void *dbh)
{
struct _pgsql_drv_storage *s;
FILE *file;
char filename[MAX_FILENAME_LENGTH];
char buffer[256];
char hostname[128] = "";
char user[64] = "";
char password[32] = "";
char db[64] = "";
int port = 5432, i = 0;
// PGresult *result;
/* don't init if we're already initted */
if (CTX->storage != NULL)
{
LOGDEBUG ("_ds_init_storage: storage already initialized");
return EINVAL;
}
s = malloc (sizeof (struct _pgsql_drv_storage));
if (s == NULL)
{
LOG (LOG_CRIT, ERROR_MEM_ALLOC);
return EUNKNOWN;
}
s->dbh = NULL;
s->control_token = 0;
s->iter_user = NULL;
s->iter_token = NULL;
s->iter_sig = NULL;
s->control_token = 0;
s->control_sh = 0;
s->control_ih = 0;
s->dbh_attached = (dbh) ? 1 : 0;
s->u_getnextuser[0] = 0;
s->p_getpwnam = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL };
^^^^^^^^^^^^^^^^^^^^ !
s->p_getpwuid = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL };
^^^^^^^^^^^^^^^^^^^^ !
Andreas ///
--
http://www.64bits.de
http://www.apsfilter.org
http://people.FreeBSD.org/~andreas
More information about the freebsd-hackers
mailing list