optiontable: replace stdin with filename arg, harden `open()` call
No binary (build failed)
—
(log yok)
| @@ -379,7 +379,7 @@ endif() | |
| if(PERL_EXECUTABLE) | |
| add_custom_target(curl-optiontable | |
| COMMENT "Generating lib/easyoptions.c" VERBATIM USES_TERMINAL | |
| - | COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/optiontable.pl" < "${PROJECT_SOURCE_DIR}/include/curl/curl.h" |
| + | COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/optiontable.pl" "${PROJECT_SOURCE_DIR}/include/curl/curl.h" |
| > "${PROJECT_SOURCE_DIR}/lib/easyoptions.c" | |
| DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/optiontable.pl" "${PROJECT_SOURCE_DIR}/include/curl/curl.h" | |
| ) | |
| @@ -178,7 +178,7 @@ tidy: | |
| @CLANG_TIDY@ --config-file=$(top_srcdir)/.clang-tidy.yml $(TIDYFLAGS) $(CURL_CLANG_TIDYFLAGS) $$_csources -- $(AM_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H $(_tidy_cflags)) | |
| optiontable: | |
| - | @PERL@ $(srcdir)/optiontable.pl < $(top_srcdir)/include/curl/curl.h > $(srcdir)/easyoptions.c |
| + | @PERL@ $(srcdir)/optiontable.pl $(top_srcdir)/include/curl/curl.h > $(srcdir)/easyoptions.c |
| if HAVE_WINDRES | |
| .rc.lo: | |
| @@ -79,7 +79,9 @@ sub add { | |
| } | |
| my $fl; | |
| - | while(<STDIN>) { |
| + | my $file = shift @ARGV; |
| + | open(CURL_H, '<', $file) or die; |
| + | while(<CURL_H>) { |
| my $l = $_; | |
| if($fl) { | |
| # continued deprecation | |
| @@ -121,6 +123,7 @@ while(<STDIN>) { | |
| } | |
| } | |
| } | |
| + | close(CURL_H); |
| for my $name (sort @names) { | |
| my $oname = $name; | |
| @@ -34,7 +34,7 @@ sub showline { | |
| my $root = $ARGV[0] || '..'; | |
| - | open(my $fh, "-|", "perl $root/lib/optiontable.pl < $root/include/curl/curl.h"); |
| + | open(my $fh, "-|", 'perl', "$root/lib/optiontable.pl", "$root/include/curl/curl.h"); |
| binmode $fh; | |
| my @gen=<$fh>; | |
| close($fh); | |