shithub: scc

Download patch

ref: be91e9ff3d8d1d06cc92490d7bc1786823068d7c
parent: 848b81913101e981e2570d5167535c42018cac92
author: Quentin Rameau <quinq@fifth.space>
date: Thu May 26 05:56:44 EDT 2016

[driver] Fix the snprintf check for errors

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -41,7 +41,7 @@
 
 	r = snprintf(archtool, sizeof(archtool),
 	             arch ? "%s-%s" : "%s", tool, arch);
-	if (r == -1 || r >= sizeof(archtool))
+	if (r < 0 || r >= sizeof(archtool))
 		die("scc: incorrect target arch");
 
 	switch (pid = fork()) {
@@ -50,7 +50,7 @@
 	case 0:
 		dup2(fd, stdfd);
 		r = snprintf(cmd, sizeof(cmd), fmt, PREFIX, archtool);
-		if (r == - 1 || r >= sizeof(cmd))
+		if (r < 0 || r >= sizeof(cmd))
 			die("scc: incorrect prefix");
 		args[0] = archtool;
 		execv(cmd, args);