commit abe4b5dfa83c017b1311fb5d541bdb4c77b2010e
parent 67f222edd852878c3d8e263d8157fe698b6f7a1d
Author: Quentin Rameau <quinq@fifth.space>
Date: Thu, 26 May 2016 09:56:44 +0200
[driver] Fix the snprintf check for errors
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/driver/posix/scc.c b/driver/posix/scc.c
@@ -41,7 +41,7 @@ spawn(char *tool, char *args[NARGS], pid_t *pid_tool, int fd, int stdfd)
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 @@ spawn(char *tool, char *args[NARGS], pid_t *pid_tool, int fd, int stdfd)
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);