| @@ -9,6 +9,9 @@ · 8 unmodified lines |
| 9 | #include <stdio.h> | 9 | #include <stdio.h> |
| 10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
| 11 | #include <string.h> | 11 | #include <string.h> |
| | 12 | #ifdef _WIN32 |
| | 13 | #include <io.h> /* for mktemp */ |
| | 14 | #endif |
| 12 | | 15 | |
| 13 | /* #include "ar-elf.h" */ | 16 | /* #include "ar-elf.h" */ |
| 14 | /* "ar-elf.h" */ | 17 | /* "ar-elf.h" */ |
| @@ -177,25 +180,13 @@ int main(int argc, char **argv) · 162 unmodified lines |
| 177 | } | 180 | } |
| 178 | } | 181 | } |
| 179 | | 182 | |
| 180 | //tfile[0] = '.'; tfile[1] = '/'; | | |
| 181 | //if (tmpnam(&tfile[2])) { | | |
| 182 | strcpy(tfile, "./XXXXXX"); | 183 | strcpy(tfile, "./XXXXXX"); |
| 183 | if (mktemp(tfile)) | 184 | if (!mktemp(tfile) || (fo = fopen(tfile, "wb+")) == NULL) |
| 184 | { | 185 | { |
| 185 | if ((fo = fopen(tfile, "wb+")) == NULL) | 186 | fprintf(stderr, "Can't open temporary file %s\n", tfile); |
| 186 | { | | |
| 187 | fprintf(stderr, "Can't open file %s \n", tfile); | | |
| 188 | return 2; | | |
| 189 | } | | |
| 190 | } | | |
| 191 | | | |
| 192 | /* | | |
| 193 | if ((fo = tmpfile()) == NULL) | | |
| 194 | { | | |
| 195 | fprintf(stderr, "Can't open temporary file \n"); | | |
| 196 | return 2; | 187 | return 2; |
| 197 | } | 188 | } |
| 198 | */ | 189 | |
| 199 | if ((fh = fopen(afile, "wb")) == NULL) | 190 | if ((fh = fopen(afile, "wb")) == NULL) |
| 200 | { | 191 | { |
| 201 | fprintf(stderr, "Can't open file %s \n", afile); | 192 | fprintf(stderr, "Can't open file %s \n", afile); |