mirror of
				https://sourceware.org/git/glibc.git
				synced 2025-10-28 23:34:53 +03:00 
			
		
		
		
	Allow fopen to fail because the file does not exist.
This commit is contained in:
		| @@ -16,6 +16,7 @@ | |||||||
|    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||||||
|    02111-1307 USA.  */ |    02111-1307 USA.  */ | ||||||
|  |  | ||||||
|  | #include <errno.h> | ||||||
| #include <stdint.h> | #include <stdint.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <stdio_ext.h> | #include <stdio_ext.h> | ||||||
| @@ -33,7 +34,14 @@ __readonly_area (const char *ptr, size_t size) | |||||||
|  |  | ||||||
|   FILE *fp = fopen ("/proc/self/maps", "rc"); |   FILE *fp = fopen ("/proc/self/maps", "rc"); | ||||||
|   if (fp == NULL) |   if (fp == NULL) | ||||||
|  |     { | ||||||
|  |       if (errno == ENOENT) | ||||||
|  | 	/* It is the system administrator's choice to not have /proc | ||||||
|  | 	   available to this process (e.g., because it runs in a chroot | ||||||
|  | 	   environment.  Don't fail in this case.  */ | ||||||
|  | 	return 1; | ||||||
|       return -1; |       return -1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   /* We need no locking.  */ |   /* We need no locking.  */ | ||||||
|   __fsetlocking (fp, FSETLOCKING_BYCALLER); |   __fsetlocking (fp, FSETLOCKING_BYCALLER); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user