aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/csource')
-rw-r--r--pkg/csource/csource.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go
index 69be3ff2a..49431f655 100644
--- a/pkg/csource/csource.go
+++ b/pkg/csource/csource.go
@@ -247,7 +247,13 @@ func (ctx *context) emitCall(w *bytes.Buffer, call prog.ExecCall, ci int, haveCo
}
fmt.Fprintf(w, ");\n")
if trace {
- fmt.Fprintf(w, "\tprintf(\"### call=%v errno=%%u\\n\", res == -1 ? errno : 0);\n", ci)
+ cast := ""
+ if !native && !strings.HasPrefix(callName, "syz_") {
+ // Potentially we casted a function returning int to a function returning long.
+ // So instead of long -1 we can get 0x00000000ffffffff. Sign extend it to long.
+ cast = "(long)(int)"
+ }
+ fmt.Fprintf(w, "\tprintf(\"### call=%v errno=%%u\\n\", %vres == -1 ? errno : 0);\n", ci, cast)
}
}