summaryrefslogtreecommitdiff
path: root/src/bin/evil
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-04-01 17:55:09 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-04-02 12:14:50 +0900
commit5926aadd9e0ab50a4d043a51661f2d9e83af7cba (patch)
tree62d4da3ea146be6b88af6e5777b3cfff9f1399d5 /src/bin/evil
parent0fdb02fb51c41ddc57ec83950dd847557820aae1 (diff)
Evil: Add support for mkstemps
This adds filename suffix support for temporary files on Windows.
Diffstat (limited to 'src/bin/evil')
-rw-r--r--src/bin/evil/evil_test_mkstemp.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/bin/evil/evil_test_mkstemp.c b/src/bin/evil/evil_test_mkstemp.c
index a716b726aa..427dc01289 100644
--- a/src/bin/evil/evil_test_mkstemp.c
+++ b/src/bin/evil/evil_test_mkstemp.c
@@ -36,18 +36,59 @@ test_mkstemp_test(void)
36} 36}
37 37
38static int 38static int
39test_mkstemps_test(void)
40{
41 char _template[PATH_MAX];
42#ifdef _WIN32_WCE
43 char cwd[PATH_MAX];
44#endif
45 int fd;
46
47#ifdef _WIN32_WCE
48 if (!getcwd(cwd, PATH_MAX))
49 return 0;
50 _snprintf(_template, PATH_MAX, "%s\\%s", cwd, "file_XXXXXX.ext");
51#else
52 _snprintf(_template, PATH_MAX, "%s", "file_XXXXXX.ext");
53#endif
54
55 fd = mkstemps(_template, 4);
56
57 if (fd < 0)
58 return 0;
59
60 return 1;
61}
62
63static int
39test_mkstemp_run(suite *s) 64test_mkstemp_run(suite *s)
40{ 65{
41 int res; 66 int res;
67 (void) s;
42 68
43 res = test_mkstemp_test(); 69 res = test_mkstemp_test();
44 70
45 return res; 71 return res;
46} 72}
47 73
74static int
75test_mkstemps_run(suite *s)
76{
77 int res;
78 (void) s;
79
80 res = test_mkstemps_test();
81
82 return res;
83}
84
48int 85int
49test_mkstemp(suite *s) 86test_mkstemp(suite *s)
50{ 87{
88 int res;
51 89
52 return test_mkstemp_run(s); 90 res = test_mkstemp_run(s);
91 res &= test_mkstemps_run(s);
92
93 return res;
53} 94}