please help with: warning: initialization makes integer from pointer

Stefan Farfeleder stefan at fafoe.narf.at
Fri Oct 8 05:41:22 PDT 2004


On Thu, Oct 07, 2004 at 07:43:22PM +0200, Andreas Klemm wrote:
> Dear FreeBSD hackers,
> 
> could somebody please help Jonathan, the dspam owner, how to code
> this best under FreeBSD ?

>   s->p_getpwnam = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL };
>  ^^^^^^^^^^^^^^^^^^^^ !
>   s->p_getpwuid = (struct passwd) { NULL, NULL, 0, 0, NULL, NULL, NULL };
>  ^^^^^^^^^^^^^^^^^^^^ !

This works but might cause (harmless) warnings about missing
initialisers:

s->p_getpwnam = (struct passwd) { 0 };
s->p_getpwuid = (struct passwd) { 0 };

Alternatively:

static struct passwd zero_pwd;
s->p_getpwnam = zero_pwd;
s->p_getpwuid = zero_pwd;

Cheers,
Stefan


More information about the freebsd-hackers mailing list