File mc-uglydir.patch of Package mc46

--- mc-4.6.1-20041105/src/subshell.c.uglydir	2004-11-03 20:43:17.000000000 +0100
+++ mc-4.6.1-20041105/src/subshell.c	2004-11-05 17:21:19.245271256 +0100
@@ -954,6 +954,22 @@ feed_subshell (int how, int fail_on_erro
 
 	    subshell_cwd[bytes - 1] = 0;	/* Squash the final '\n' */
 
+	    if (*subshell_cwd && current_panel && current_panel->cwd && strcmp(current_panel->cwd, subshell_cwd) &&
+			strchr(current_panel->cwd, '\n'))
+	    {
+                /* Expected CWD is diffrent and it contains line break. 
+	         * We need to read rest of CWD, because previous read() 
+	         * returns first line only.
+	         */
+	        int rbytes;
+	
+	        subshell_cwd[bytes-1] = '\n';  
+                rbytes = read(subshell_pipe[READ], (subshell_cwd+bytes), 
+			                              MC_MAXPATHLEN-bytes);
+	        if (rbytes)
+		     subshell_cwd[bytes+rbytes-1] = 0;  /* Squash the final '\n' */
+	    }
+	
 	    synchronize ();
 
 	    subshell_ready = TRUE;
openSUSE Build Service is sponsored by