shell: Fix "read -d ''" behavior
With bash's read builtin it is possible to read from a file (e.g. device-tree) until the first '\0' character: IFS= read -r -d '' VARIABLE < file In busybox ash the -d extension is also implemented, but checking the read character for '\0' has to be performed after comparing with the delimiter. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
		
				
					committed by
					
						
						Denys Vlasenko
					
				
			
			
				
	
			
			
			
						parent
						
							a088da4476
						
					
				
				
					commit
					39925026f6
				
			
							
								
								
									
										1
									
								
								shell/ash_test/ash-read/read_d0.right
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								shell/ash_test/ash-read/read_d0.right
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
test
 | 
			
		||||
							
								
								
									
										1
									
								
								shell/ash_test/ash-read/read_d0.tests
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										1
									
								
								shell/ash_test/ash-read/read_d0.tests
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
printf 'test\0zest\n' | (read -d '' reply; echo "$reply")
 | 
			
		||||
		Reference in New Issue
	
	Block a user