tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rpcgen with env variable CPP set to "cc -E"



In article <18315.64416.959126.91093%ficus.home@localhost>,
Anthony Mallet  <anthony.mallet%useless-ficus.net@localhost> wrote:
>der Mouse writes:
>| Does this actually work?  Based on the manpage, popen() expects a shell
>| command line as a single string, not the argv array you appear to be
>| passing it.  Am I missing something?
>
>I'm not passing an argv array, but a single string. I admit that I could
>have renamed arglist into something else...
>And yes, this string is leaked. There should be a call to clear_args()
>before the final exit().
>
>Also the pclose() should be called three time when rpcgen is invoked with
>no flags (parses 3 times the input), but the fclose was already
>missing in the current version and I wasn't 100% sure why.
>
>| Furthermore, if you do construct a shell command, won't that lose when
>| the filename in question contains shell metacharacters such as
>| whitespace?  (This may not be enough of a problem in practice to nix
>| the technique, but IMO should be loudly warned about in the relevant
>| manpage.)
>
>Yes that's true, I missed this one. Ideally the input file should be
>passed through cpp's stdin. But I'm not sure if '-' as a filename can be
>used in a standard way?

Not to discourage you, but this patch creates more problems than it solves,
and it introduces a non-portable rpcgen behavior. If you want to use a custom
cpp, go a step further and make a shell script that behaves the way you want
instead of modifying the source... I think it would be easier to make this
an argv vector and keep using execv...

christos

christos




Home | Main Index | Thread Index | Old Index