[uClibc-cvs] uClibc/utils ldd.c,1.10,1.11
Erik Andersen
andersen at uclibc.org
Fri Feb 13 11:11:12 UTC 2004
Update of /var/cvs/uClibc/utils
In directory nail:/tmp/cvs-serv27556
Modified Files:
ldd.c
Log Message:
Yet more fixups..
Index: ldd.c
===================================================================
RCS file: /var/cvs/uClibc/utils/ldd.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ldd.c 13 Feb 2004 11:05:36 -0000 1.10
+++ ldd.c 13 Feb 2004 11:11:10 -0000 1.11
@@ -462,6 +462,7 @@
free(newlib->name);
if (newlib->path != not_found) {
free(newlib->path);
+ }
newlib->name = NULL;
newlib->path = NULL;
return NULL;
@@ -516,7 +517,7 @@
}
if (fstat(fileno(thefile), &statbuf) < 0) {
perror(filename);
- flose(thefile);
+ fclose(thefile);
return -1;
}
@@ -529,9 +530,14 @@
/* mmap the file to make reading stuff from it effortless */
ehdr = (Elf32_Ehdr *)mmap(0, statbuf.st_size,
PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(thefile), 0);
+ if (ehdr == MAP_FAILED) {
+ fclose(thefile);
+ fprintf(stderr, "Out of memory!\n");
+ return -1;
+ }
foo:
- flose(thefile);
+ fclose(thefile);
/* Check if this looks like a legit ELF file */
if (check_elf_header(ehdr)) {
More information about the uClibc-cvs
mailing list