Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Avoid analysing symbolic links for shared library usage -- previous code would analyse the file the sym-link pointed to.
Matthew Seaman committed 13 years ago
commit 7afe682fb62642c5219d099b9a7fa00dc2bafa57
parent ec867f8
1 file changed +4 -4
modified libpkg/pkg_elf.c
@@ -258,16 +258,16 @@ analyse_elf(struct pkg *pkg, const char *fpath,

	int fd;

-
	if ((fd = open(fpath, O_RDONLY, 0)) < 0) {
-
		return (EPKG_FATAL);
-
	}
-
	if (fstat(fd, &sb) != 0)
+
	if (lstat(fpath, &sb) != 0)
		pkg_emit_errno("fstat() failed for %s", fpath);
	/* ignore empty files and non regular files */
	if (sb.st_size == 0 || !S_ISREG(sb.st_mode)) {
		ret = EPKG_END; /* Empty file: no results */
		goto cleanup;
	}
+
	if ((fd = open(fpath, O_RDONLY, 0)) < 0) {
+
		return (EPKG_FATAL);
+
	}

	if ((e = elf_begin(fd, ELF_C_READ, NULL)) == NULL) {
		ret = EPKG_FATAL;