Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bb13be5145e18cfb3a2f9cc6091aa048d032a3cd
Commit:     bb13be5145e18cfb3a2f9cc6091aa048d032a3cd
Parent:     4b21960f90d4d011e49e386d0525b1e89f320658
Author:     Rob Landley <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 9 01:25:18 2007 -0500
Committer:  Sam Ravnborg <[EMAIL PROTECTED](none)>
CommitDate: Thu Oct 18 13:42:53 2007 +0200

    kbuild: stop docproc segfaulting when SRCTREE isn't set.
    
    Prevent docproc from segfaulting when SRCTREE isn't set.
    
    Signed-off-by: Rob Landley <[EMAIL PROTECTED]>
    Acked-by: Randy Dunlap <[EMAIL PROTECTED]>
    Signed-off-by: Sam Ravnborg <[EMAIL PROTECTED]>
---
 scripts/basic/docproc.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c
index e5c6ac7..0e4bd54 100644
--- a/scripts/basic/docproc.c
+++ b/scripts/basic/docproc.c
@@ -66,12 +66,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");
 }
 
 /*
@@ -90,7 +93,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);
@@ -171,7 +174,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);
@@ -338,6 +341,10 @@ void parse_file(FILE *infile)
 int main(int argc, char *argv[])
 {
        FILE * infile;
+
+       srctree = getenv("SRCTREE");
+       if (!srctree)
+               srctree = getcwd(NULL, 0);
        if (argc != 3) {
                usage();
                exit(1);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to