ref: 271754d6f1e0beeb18ddfa17513811fd1b8a0892
parent: c2d71566fa9857e9cb87d0508d9b75f7f5fe2c94
author: Quentin Rameau <[email protected]>
date: Sun Dec 4 05:36:21 EST 2016
[driver] fix temporary object generation for old POSIX Pre-susv4 mkstemp don't impose a filename format and don't provide EINVAL error on which we were counting.
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -163,10 +163,12 @@
n = snprintf(new, newsz, "%.*s%c%s", (int)pathln, path, sep, type);
if (n < 0 || n >= newsz)
die("scc: wrong output filename");
- if ((tmpfd = mkstemp(new)) < 0 && errno != EINVAL)
- die("scc: could not create output file '%s': %s",
- new, strerror(errno));
- close(tmpfd);
+ if (sep == '/') {
+ if ((tmpfd = mkstemp(new)) < 0)
+ die("scc: could not create output file '%s': %s",
+ new, strerror(errno));
+ close(tmpfd);
+ }
return new;
}