Browse Source

Only exec child apps if they are elf type ET_EXEC

Eric Andersen 21 years ago
parent
commit
08601aa549
1 changed files with 3 additions and 2 deletions
  1. 3 2
      ldso/util/ldd.c

+ 3 - 2
ldso/util/ldd.c

@@ -535,7 +535,8 @@ foo:
 	interp = find_elf_interpreter(ehdr);
 			
 #ifdef __LDSO_LDD_SUPPORT
-	if (interp && ehdr->e_ident[EI_CLASS] == ELFCLASSM && ehdr->e_ident[EI_DATA] == ELFDATAM
+	if (interp && ehdr->e_type == ET_EXEC && ehdr->e_ident[EI_CLASS] == ELFCLASSM && 
+			ehdr->e_ident[EI_DATA] == ELFDATAM
 		&& ehdr->e_ident[EI_VERSION] == EV_CURRENT && MATCH_MACHINE(ehdr->e_machine)) 
 	{
 		struct stat statbuf;
@@ -558,7 +559,7 @@ foo:
 
 			/* Wait till it returns */
 			waitpid(pid, &status, 0);
-			if (WIFEXITED(status)!=0xdead) {
+			if (WIFEXITED(status) && WEXITSTATUS(status)==0) {
 				return 1;
 			}