From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 7 17:45:09 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E8CCD16A4CE for ; Thu, 7 Oct 2004 17:45:08 +0000 (GMT) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id C371B43D39 for ; Thu, 7 Oct 2004 17:45:07 +0000 (GMT) (envelope-from andreas@klemm.apsfilter.org) Received: from srv1.cosmo-project.de (localhost [IPv6:::1]) i97Hj5aI009194 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Thu, 7 Oct 2004 19:45:05 +0200 (CEST) (envelope-from andreas@klemm.apsfilter.org) Received: (from uucp@localhost)i97Hj5qJ009193; Thu, 7 Oct 2004 19:45:05 +0200 (CEST) (envelope-from andreas@klemm.apsfilter.org) Received: from titan.klemm.apsfilter.org (localhost.klemm.apsfilter.org [127.0.0.1]) by klemm.apsfilter.org (8.13.1/8.13.1) with ESMTP id i97HhNuZ004135; Thu, 7 Oct 2004 19:43:23 +0200 (CEST) (envelope-from andreas@titan.klemm.apsfilter.org) Received: (from andreas@localhost) by titan.klemm.apsfilter.org (8.13.1/8.13.1/Submit) id i97HhMVZ004134; Thu, 7 Oct 2004 19:43:22 +0200 (CEST) (envelope-from andreas) Date: Thu, 7 Oct 2004 19:43:22 +0200 From: Andreas Klemm To: hackers@freebsd.org Message-ID: <20041007174322.GB3414@titan.klemm.apsfilter.org> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <416579E1.8050308@nuclearelephant.com> X-Operating-System: FreeBSD 5.3-BETA7 X-Disclaimer: A free society is one where it is safe to be unpopular User-Agent: Mutt/1.5.6i X-Mailman-Approved-At: Fri, 08 Oct 2004 12:06:49 +0000 cc: "Jonathan A. Zdziarski" Subject: please help with: warning: initialization makes integer from pointer X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2004 17:45:09 -0000 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