summaryrefslogtreecommitdiff
path: root/dmake
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2010-10-15 11:15:45 +0200
committerJan Holesovsky <kendy@suse.cz>2010-10-15 11:18:00 +0200
commit9fcbf78116c0d2038b335696c6839e3a84090bac (patch)
tree68f6d6f70e9144f90958df725cc80ffab7b114f9 /dmake
parentf06879087e872786f56084f504f3296ee79a0ee5 (diff)
Fix dmake's behavior when the environment is broken.
You can have environment with spaces in the name of the environment variable. Even though this is broken, it does not cause trouble to most of the tools around, so we should work that around in dmake too ;-) dmake-space-in-envvar-name.diff, i#101786
Diffstat (limited to 'dmake')
-rw-r--r--dmake/getinp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/dmake/getinp.c b/dmake/getinp.c
index 5445193d1a90..1ac312a53b59 100644
--- a/dmake/getinp.c
+++ b/dmake/getinp.c
@@ -88,17 +88,23 @@ FILE *fil;
/* Reading the internal rule table. Set rule_ind to zero after the
* last entry so that ReadEnvironment() works as expected every time. */
- while( (p = Rule_tab[ rule_ind++ ]) != NIL(char) )
+ while( (p = Rule_tab[ rule_ind++ ]) != NIL(char) ) {
/* The last test in this if *p != '~', handles the environment
* passing conventions used by MKS to pass arguments. We want to
* skip those environment entries. Also CYGWIN likes to export '!'
- * prefixed environment variables that cause severe pain, axe them too */
- if( !Readenv || (Readenv && (strchr(p,'=') != NIL(char)) && *p!='~' && *p!='!')){
+ * prefixed environment variables that cause severe pain, axe them too.
+ * And finally it is possible to do "env 'GGG HHH'='some value' bash"
+ * which causes that there are env variables with spaces in the name
+ * defined which causes dmake to malfunction too */
+ char *equal = strchr(p,'=');
+ char *space = strchr(p,' ');
+ if( !Readenv || (Readenv && (equal != NIL(char)) && (space == NIL(char) || space > equal) && *p!='~' && *p!='!')){
strcpy( buf, p );
DB_PRINT( "io", ("Returning [%s]", buf) );
DB_RETURN( FALSE );
}
+ }
rule_ind = 0;