1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-21 23:18:00 -08:00

rpcgen(1): default to "STDIN" as input file when compiling to headers.

FreeBSD, NetBSD, and GNU all use a variation of "STDIN" as the
default input filename when compiling to header files (-h) to prevent
a NULL-pointer deference. Adopt a similar approach.

ok millert@
This commit is contained in:
dv 2024-07-22 17:55:18 +00:00
parent 50deb69b41
commit 134d7b1ef9

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rpc_main.c,v 1.35 2019/06/28 13:35:03 deraadt Exp $ */
/* $OpenBSD: rpc_main.c,v 1.36 2024/07/22 17:55:18 dv Exp $ */
/* $NetBSD: rpc_main.c,v 1.9 1996/02/19 11:12:43 pk Exp $ */
/*
@ -480,7 +480,10 @@ h_output(infile, define, extend, outfile)
outfilename = extend ? extendfile(infile, outfile) : outfile;
open_output(infile, outfilename);
add_warning();
guard = generate_guard(outfilename ? outfilename : infile);
if (outfilename || infile)
guard = generate_guard(outfilename ? outfilename : infile);
else
guard = generate_guard("STDIN");
fprintf(fout, "#ifndef _%s\n#define _%s\n\n", guard,
guard);