| 
									
										
										
										
											2017-09-28 12:40:26 +03:00
										 |  |  | /*
 | 
					
						
							|  |  |  | This file is part of Telegram Desktop, | 
					
						
							| 
									
										
										
										
											2018-01-03 13:23:14 +03:00
										 |  |  | the official desktop application for the Telegram messaging service. | 
					
						
							| 
									
										
										
										
											2017-09-28 12:40:26 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-03 13:23:14 +03:00
										 |  |  | For license and copyright information please follow this link: | 
					
						
							|  |  |  | https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
					
						
							| 
									
										
										
										
											2017-09-28 12:40:26 +03:00
										 |  |  | */ | 
					
						
							|  |  |  | #include <stdlib.h>
 | 
					
						
							|  |  |  | #include <unistd.h>
 | 
					
						
							|  |  |  | #include <sys/types.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void *__wrap_aligned_alloc(size_t alignment, size_t size) { | 
					
						
							|  |  |  | 	void *result = NULL; | 
					
						
							|  |  |  | 	return (posix_memalign(&result, alignment, size) == 0) | 
					
						
							|  |  |  | 		? result | 
					
						
							|  |  |  | 		: NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int enable_secure_inited = 0; | 
					
						
							|  |  |  | int enable_secure = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *__wrap_secure_getenv(const char *name) { | 
					
						
							|  |  |  | 	if (enable_secure_inited == 0) { | 
					
						
							|  |  |  | 		enable_secure_inited = 1; | 
					
						
							|  |  |  | 		enable_secure = (geteuid() != getuid()) | 
					
						
							|  |  |  | 		|| (getegid() != getgid()); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return enable_secure ? NULL : getenv(name); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 |