This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: fix 12099 -- quick review?
Rayson Ho <raysonlogin@gmail.com> writes:
> I am going to check the code in if no one has complains about the fix.
> + FILE *fp = fopen (user_path.c_str(), "r");
> + if (fp != NULL)
> + {
> + char buffer[PATH_MAX + 1 + 2]; // max path len + \n + #!
> + if (fgets (buffer, PATH_MAX + 1 + 2, fp))
> + size_t plen = strlen (buffer);
> + if (plen > sizeof ("#!") && memcmp (buffer, "#!", sizeof
> ("#!")-1) == 0)
> + {
> [...]
I bet it would be simpler if the code used c++ iostreams rather than
C stdio in order to parse first line of the shell script.
- FChE