summaryrefslogtreecommitdiffstats
path: root/giflib-5.0.4_mkstemp.patch
blob: 09e6680de258100dac32c57d64b3359ce6bcc9c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff -rupN giflib-5.0.4/util/gifinto.c giflib-5.0.4-new/util/gifinto.c
--- giflib-5.0.4/util/gifinto.c	2012-10-17 02:10:20.000000000 +0200
+++ giflib-5.0.4-new/util/gifinto.c	2013-08-09 00:33:11.864642920 +0200
@@ -105,7 +105,15 @@ int main(int argc, char **argv)
     if ( (strlen(FoutTmpName) + strlen(DEFAULT_TMP_NAME))  > STRLEN-1 ) GIF_EXIT("Filename too long.");
     strcat(FoutTmpName, DEFAULT_TMP_NAME);
     int FD;
+#ifdef _WIN32
+    char *tmpFN = _mktemp(FoutTmpName);
+    if (tmpFN)
+	FD = open(tmpFN, O_CREAT | O_EXCL | O_WRONLY);
+    else
+	FD = -1;
+#else
     FD = mkstemp(FoutTmpName); /* returns filedescriptor */
+#endif
     if (FD == -1 )
     {
 	GIF_EXIT("Failed to open output.");