mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	Backport the ksh2020 fix for timezone name determination
This fix for `printf '%T' now` on FreeBSD was written by @krader1961. This is from https://github.com/att/ast/pull/591: On FreeBSD calling tzset() does not guarantee the tzname array will be correctly populated. On most systems that works but on FreeBSD you have to call localtime() or a related function (e.g., ctime()). This change also eliminates a potential, very small, memory leak due to the strdup()'ed tznames not being freed. src/lib/libast/tm/tminit.c: - Fix timezone name determination on FreeBSD and a memory leak.
This commit is contained in:
		
							parent
							
								
									289f56cd4c
								
							
						
					
					
						commit
						d7c9470704
					
				
					 2 changed files with 6 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -247,10 +247,6 @@ tmlocal(void)
 | 
			
		|||
		else if (e)
 | 
			
		||||
			environ[0] = e;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
#if _dat_tzname
 | 
			
		||||
	local.standard = strdup(tzname[0]);
 | 
			
		||||
	local.daylight = strdup(tzname[1]);
 | 
			
		||||
#endif
 | 
			
		||||
	tmlocale();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -296,10 +292,8 @@ tmlocal(void)
 | 
			
		|||
		 * POSIX
 | 
			
		||||
		 */
 | 
			
		||||
 | 
			
		||||
		if (!local.standard)
 | 
			
		||||
			local.standard = strdup(tzname[0]);
 | 
			
		||||
		if (!local.daylight)
 | 
			
		||||
			local.daylight = strdup(tzname[1]);
 | 
			
		||||
		local.standard = strdup(tzname[0]);
 | 
			
		||||
		local.daylight = strdup(tzname[1]);
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue