[hackers] [scc] [driver] Fix the snprintf check for errors || Quentin Rameau
commit abe4b5dfa83c017b1311fb5d541bdb4c77b2010e
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Thu May 26 09:56:44 2016 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Thu May 26 09:56:44 2016 +0200
[driver] Fix the snprintf check for errors
diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index ef21e0a..b7be1fc 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
_AT_@ -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()) {
_AT_@ -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);
Received on Thu May 26 2016 - 09:57:25 CEST
This archive was generated by hypermail 2.3.0
: Thu May 26 2016 - 10:00:15 CEST