From: dv Date: Mon, 22 Jul 2024 17:55:18 +0000 (+0000) Subject: rpcgen(1): default to "STDIN" as input file when compiling to headers. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=134d7b1ef94ae6f4f6ffb58b17fcd2643c6ae9ac;p=openbsd 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@ --- diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index 3d04fdc7f9e..ef82a734429 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -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);