svn commit: r317932 - stable/11/contrib/elftoolchain/elfcopy

Ed Maste emaste at FreeBSD.org
Mon May 8 01:29:42 UTC 2017


Author: emaste
Date: Mon May  8 01:29:40 2017
New Revision: 317932
URL: https://svnweb.freebsd.org/changeset/base/317932

Log:
  MFC r317371: elfcopy: allow empty symbol list files

Modified:
  stable/11/contrib/elftoolchain/elfcopy/main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/elfcopy/main.c
==============================================================================
--- stable/11/contrib/elftoolchain/elfcopy/main.c	Mon May  8 00:45:05 2017	(r317931)
+++ stable/11/contrib/elftoolchain/elfcopy/main.c	Mon May  8 01:29:40 2017	(r317932)
@@ -1285,8 +1285,9 @@ parse_symlist_file(struct elfcopy *ecp, 
 		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';
 


More information about the svn-src-all mailing list