Enable the code that reads /etc/pcnfsd.conf. It was disabled because

rpcgen offers no mechanism to call it from the rpcgen-created main().
So, use the preprocessor to rename that mymain() and provide another
main() that loads the config file first.

PR bin/12758.
This commit is contained in:
dholland 2008-09-30 05:20:42 +00:00
parent d65073510e
commit fe23e175c3
2 changed files with 21 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.19 2008/09/27 04:47:01 reed Exp $
# $NetBSD: Makefile,v 1.20 2008/09/30 05:20:42 dholland Exp $
.include <bsd.own.mk>
@ -8,6 +8,9 @@ BUILDSYMLINKS+= pcnfsd.8 rpc.pcnfsd.8
MLINKS= rpc.pcnfsd.8 pcnfsd.8
CPPFLAGS += -DUSER_CACHE -DWTMP -I. -DSUPPORT_UTMP -DSUPPORT_UTMPX
# hack to allow config file to be read (see PR 12758)
CPPFLAGS+=-Dmain=mymain
.if (${USE_YP} != "no")
CPPFLAGS+=-DUSE_YP
.endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcnfsd_misc.c,v 1.10 2003/07/16 08:22:01 itojun Exp $ */
/* $NetBSD: pcnfsd_misc.c,v 1.11 2008/09/30 05:20:42 dholland Exp $ */
/* RE_SID: @(%)/usr/dosnfs/shades_SCCS/unix/pcnfsd/v2/src/SCCS/s.pcnfsd_misc.c 1.5 92/01/24 19:59:13 SMI */
/*
@ -491,7 +491,6 @@ su_pclose(ptr)
#if XXX_unused
/*
** The following routine reads a file "/etc/pcnfsd.conf" if present,
** and uses it to replace certain builtin elements, like the
@ -507,8 +506,8 @@ su_pclose(ptr)
** printer name alias-for command
** wtmp yes|no
*/
void
config_from_file()
static void
config_from_file(void)
{
FILE *fd;
char buff[1024];
@ -559,8 +558,21 @@ config_from_file()
}
fclose(fd);
}
#endif /* XXX_unused */
/*
** hack for main() - call config_from_file() then the real main
** in the rpcgen output, which is hacked by CPPFLAGS to be "mymain"
*/
#undef main
int mymain(int argc, char *argv[]);
int
main(int argc, char *argv[])
{
config_from_file();
return mymain(argc, argv);
}
/*
** strembedded - returns true if s1 is embedded (in any case) in s2