summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2017-05-08 01:29:40 +0000
committeremaste <emaste@FreeBSD.org>2017-05-08 01:29:40 +0000
commit21a0149b39d932d2cc8d82064b25c5bc80f023d7 (patch)
tree3a5734c31dc275a3deebb1b36a7a61612153d1b8 /contrib/elftoolchain
parentb0f66675ae008205703dbe32a253e6beea58e304 (diff)
downloadFreeBSD-src-21a0149b39d932d2cc8d82064b25c5bc80f023d7.zip
FreeBSD-src-21a0149b39d932d2cc8d82064b25c5bc80f023d7.tar.gz
MFC r317371: elfcopy: allow empty symbol list files
Diffstat (limited to 'contrib/elftoolchain')
-rw-r--r--contrib/elftoolchain/elfcopy/main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c
index b85845a..5d9290f 100644
--- a/contrib/elftoolchain/elfcopy/main.c
+++ b/contrib/elftoolchain/elfcopy/main.c
@@ -1285,8 +1285,9 @@ parse_symlist_file(struct elfcopy *ecp, const char *fn, unsigned int op)
err(EXIT_FAILURE, "can not open %s", fn);
if ((data = malloc(sb.st_size + 1)) == NULL)
err(EXIT_FAILURE, "malloc failed");
- if (fread(data, 1, sb.st_size, fp) == 0 || ferror(fp))
- err(EXIT_FAILURE, "fread failed");
+ if (sb.st_size > 0)
+ if (fread(data, sb.st_size, 1, fp) != 1)
+ err(EXIT_FAILURE, "fread failed");
fclose(fp);
data[sb.st_size] = '\0';
OpenPOWER on IntegriCloud