Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Don't error out when there's no notes section in an Elf object. For now, assume such files are FreeBSD native.
Matthew Seaman committed 14 years ago
commit 20bbc645b8b32f96eb35fa1c6bc4bf937f7c8c27
parent 591b9ae4ab0e861cfe495929b7d33d552f6a2aab
1 file changed +8 -12
modified libpkg/pkg_elf.c
@@ -160,18 +160,14 @@ analyse_elf(const char *fpath, const char ***namelist)
			break;
	}

-
	if  (scn == NULL) {
-
		ret = EPKG_FATAL;
-
		pkg_emit_error("failed to get the note section for %s", fpath);
-
		goto cleanup;
-
	}
-

-
	data = elf_getdata(scn, NULL);
-
        osname = (const char *) data->d_buf + sizeof(Elf_Note);
-
	if (strncasecmp(osname, "freebsd", sizeof("freebsd")) != 0) {
-
		ret = EPKG_END;	/* Foreign (probably linux) ELF object */
-
		pkg_emit_error("ingnoring %s ELF object", osname);
-
		goto cleanup;
+
	if  (scn != NULL) { /* Assume FreeBSD native if no note section */
+
		data = elf_getdata(scn, NULL);
+
		osname = (const char *) data->d_buf + sizeof(Elf_Note);
+
		if (strncasecmp(osname, "freebsd", sizeof("freebsd")) != 0) {
+
			ret = EPKG_END;	/* Foreign (probably linux) ELF object */
+
			pkg_emit_error("ingnoring %s ELF object", osname);
+
			goto cleanup;
+
		}
	}

	scn = NULL;