freebsd-ports/emulators/open-vm-tools/files/patch-services_plugins_vix_vixTools.c
Josh Paetzel 8bea5017d1 Fix build with clang 6.0.0
Also avoids an endless loop in practice

PR:	224816
Submitted by:	dim
2018-01-02 14:45:06 +00:00

29 lines
837 B
C

--- services/plugins/vix/vixTools.c.orig 2017-12-15 21:11:49 UTC
+++ services/plugins/vix/vixTools.c
@@ -52,6 +52,7 @@
#include <stdarg.h>
#include <fcntl.h>
#include <errno.h>
+#include <limits.h>
#ifdef _WIN32
#include <WTypes.h>
@@ -7330,7 +7331,7 @@ VixToolsRunScript(VixCommandRequestHeader *requestMsg,
goto abort;
}
}
- for (var = 0; var <= 0xFFFFFFFF; var++) {
+ for (var = 0; ; var++) {
free(tempScriptFilePath);
tempScriptFilePath = Str_SafeAsprintf(NULL,
"%s"DIRSEPS"%s%d%s",
@@ -7372,6 +7373,9 @@ VixToolsRunScript(VixCommandRequestHeader *requestMsg,
* deletes it), we should not try 4+ billion times.
*/
break;
+ }
+ if (var == INT_MAX) {
+ break;
}
}
if (fd < 0) {