Date: Thu, 7 Oct 2004 19:43:22 +0200 From: Andreas Klemm <andreas@klemm.apsfilter.org> To: hackers@freebsd.org Cc: "Jonathan A. Zdziarski" <jonathan@nuclearelephant.com> Subject: please help with: warning: initialization makes integer from pointer Message-ID: <20041007174322.GB3414@titan.klemm.apsfilter.org> In-Reply-To: <416579E1.8050308@nuclearelephant.com> References: <20041005054213.GA11770@lesanti.hq.sinectis.com.ar> <416234B1.8020406@nuclearelephant.com> <20041005202816.GA14973@titan.klemm.apsfilter.org> <20041005205040.GH31397@lesanti.hq.sinectis.com.ar> <20041006060437.GA23364@titan.klemm.apsfilter.org> <20041006144220.GA29653@lesanti.hq.sinectis.com.ar> <20041007111139.GA16296@titan.klemm.apsfilter.org> <416579E1.8050308@nuclearelephant.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041007174322.GB3414>