File: fix_empty_path_element

package info (click to toggle)
sash 3.8-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 768 kB
  • sloc: ansic: 8,177; makefile: 47; sh: 10
file content (16 lines) | stat: -rw-r--r-- 429 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Description: Fix the semantics of empty elements in the $PATH
 This patch allows the where builtin command to consider empty entries
 like e.g. in PATH=:/sbin:/bin to represent the current directory.
Author: Marco d'Itri <md@linux.it>

--- a/cmds.c
+++ b/cmds.c
@@ -1453,7 +1453,7 @@ do_where(int argc, const char ** argv)
 		 */
 		dirName = path;
 
-		if (dirName == '\0')
+		if (dirName[0] == '\0')
 			dirName = ".";
 
 		/*