From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 8 15:21:14 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 D794216A4CE for ; Fri, 8 Oct 2004 15:21:14 +0000 (GMT) Received: from cs1.cs.huji.ac.il (cs1.cs.huji.ac.il [132.65.16.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8A64C43D39 for ; Fri, 8 Oct 2004 15:21:14 +0000 (GMT) (envelope-from danny@cs.huji.ac.il) Received: from pampa.cs.huji.ac.il ([132.65.80.32]) by cs1.cs.huji.ac.il with esmtp id 1CFwYS-0003No-GC; Fri, 08 Oct 2004 17:21:12 +0200 X-Mailer: exmh version 2.7.0 06/18/2004 with nmh-1.0.4 To: Andreas Klemm In-Reply-To: Message from Andreas Klemm <20041007174322.GB3414@titan.klemm.apsfilter.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 08 Oct 2004 17:21:12 +0200 From: Danny Braniss Message-Id: <20041008152114.8A64C43D39@mx1.FreeBSD.org> cc: hackers@freebsd.org cc: "Jonathan A. Zdziarski" Subject: Re: 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: Fri, 08 Oct 2004 15:21:15 -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 /// what about: s = calloc (1, sizeof (struct _pgsql_drv_storage)); if (s == NULL) { LOG (LOG_CRIT, ERROR_MEM_ALLOC); return EUNKNOWN; } if(dbh) s->dbh_attached = 1; danny