shithub: scc

Download patch

ref: a78aa8e9102b99401b40601d355e13c10e2e64e7
parent: b655b80b15ef2d934fd68bdf280aa0e0d6659287
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Nov 28 15:35:39 EST 2017

[objdump] Delay print name

Don't print anything until be sure it is a valid object.

--- a/objdump/main.c
+++ b/objdump/main.c
@@ -209,7 +209,6 @@
 	FILE *fp;
 	struct myrohdr hdr;
 
-	puts(fname);
 	if ((fp = fopen(fname, "rb")) == NULL)
 		goto wrong_file;
 	if (rdmyrohdr(fp, &hdr) < 0)
@@ -220,6 +219,7 @@
 		        fname);
 		goto close_file;
 	}
+	puts(fname);
 	if (hdr.strsize > SIZE_MAX) {
 		fprintf(stderr,
 			"objdump: %s: overflow in header\n",