[monkey-bubble: 665/753] Duplicated INFOPATH before passing to strtok to prevent actual env var



commit de2e06944ed86b10d6ae6e32a29a3ab95bc6cdb6
Author: Philip Langdale <philipl mail utexas edu>
Date:   Sat Aug 25 23:47:18 2001 +0000

    Duplicated INFOPATH before passing to strtok to prevent actual env var
    
    2001-08-25  Philip Langdale  <philipl mail utexas edu>
    
            * gnome-info2html2/main.c: Duplicated INFOPATH before passing
            to strtok to prevent actual env var getting corrupted.

 help-converters/info/main.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/help-converters/info/main.c b/help-converters/info/main.c
index eb8893a..5ccc70b 100644
--- a/help-converters/info/main.c
+++ b/help-converters/info/main.c
@@ -77,7 +77,9 @@ main(int argc, char **argv)
 	for(n = 0; args[n]; n++) /* */;
 	if(n == 1 && !file_exists(args[0]))
 	  {
-	    char *ctmp, *infopath = g_getenv("INFOPATH");
+	    /* As strtok destroys the string it parses and g_getenv returns a pointer to
+	       the actually env var, we have to duplicate the var before parsing it. */
+	    char *ctmp, *infopath = g_strdup(g_getenv("INFOPATH"));
 	    char *dirs[64], *ext = NULL;
 	    int ndirs;
 	    char buf[PATH_MAX];



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]