From: Randy Dunlap <randy.dunlap@oracle.com>
To: Rob Landley <rob@landley.net>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
rdunlap@xenotime.net
Subject: Re: [PATCH] Stop docproc segfaulting when SRCTREE isn't set.
Date: Tue, 9 Oct 2007 08:56:36 -0700 [thread overview]
Message-ID: <20071009085636.3e19a55a.randy.dunlap@oracle.com> (raw)
In-Reply-To: <200710090125.19089.rob@landley.net>
On Tue, 9 Oct 2007 01:25:18 -0500 Rob Landley wrote:
> From: Rob Landley <rob@landley.net>
>
> Prevent docproc from segfaulting when SRCTREE isn't set.
>
> Signed-off-by: Rob Landley <rob@landley.net>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
but needs 2 coding style fixes... see near end, below.
> ---
>
> scripts/basic/docproc.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff -r a26a53ed1101 scripts/basic/docproc.c
> --- a/scripts/basic/docproc.c Sun Oct 07 16:42:22 2007 -0700
> +++ b/scripts/basic/docproc.c Tue Oct 09 01:08:54 2007 -0500
> @@ -64,12 +64,15 @@ FILELINE * entity_system;
> #define FUNCTION "-function"
> #define NOFUNCTION "-nofunction"
>
> +char *srctree;
> +
> void usage (void)
> {
> fprintf(stderr, "Usage: docproc {doc|depend} file\n");
> fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n");
> fprintf(stderr, "doc: frontend when generating kernel documentation\n");
> fprintf(stderr, "depend: generate list of files referenced within file\n");
> + fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n");
> }
>
> /*
> @@ -88,7 +91,7 @@ void exec_kernel_doc(char **svec)
> exit(1);
> case 0:
> memset(real_filename, 0, sizeof(real_filename));
> - strncat(real_filename, getenv("SRCTREE"), PATH_MAX);
> + strncat(real_filename, srctree, PATH_MAX);
> strncat(real_filename, KERNELDOCPATH KERNELDOC,
> PATH_MAX - strlen(real_filename));
> execvp(real_filename, svec);
> @@ -168,7 +171,7 @@ void find_export_symbols(char * filename
> if (filename_exist(filename) == NULL) {
> char real_filename[PATH_MAX + 1];
> memset(real_filename, 0, sizeof(real_filename));
> - strncat(real_filename, getenv("SRCTREE"), PATH_MAX);
> + strncat(real_filename, srctree, PATH_MAX);
> strncat(real_filename, filename,
> PATH_MAX - strlen(real_filename));
> sym = add_new_file(filename);
> @@ -335,6 +338,9 @@ int main(int argc, char *argv[])
> int main(int argc, char *argv[])
> {
> FILE * infile;
> +
> + srctree = getenv("SRCTREE");
> + if (!srctree) srctree = getcwd(NULL,0);
if (!srctree)
srctree = getcwd(NULL, 0);
> if (argc != 3) {
> usage();
> exit(1);
>
> --
---
~Randy
next prev parent reply other threads:[~2007-10-09 15:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-09 6:25 [PATCH] Stop docproc segfaulting when SRCTREE isn't set Rob Landley
2007-10-09 13:03 ` Ahmed S. Darwish
2007-10-09 15:55 ` Randy Dunlap
2007-10-09 17:19 ` Ahmed S. Darwish
2007-10-09 17:24 ` Randy Dunlap
2007-10-09 17:51 ` Ahmed S. Darwish
2007-10-09 22:19 ` Rob Landley
2007-10-09 15:56 ` Randy Dunlap [this message]
2007-10-18 11:53 ` Sam Ravnborg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071009085636.3e19a55a.randy.dunlap@oracle.com \
--to=randy.dunlap@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=rob@landley.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox