File tree Expand file tree Collapse file tree 1 file changed +7
-17
lines changed Expand file tree Collapse file tree 1 file changed +7
-17
lines changed Original file line number Diff line number Diff line change 23
23
static bool
24
24
mongoc_dump_mkdir_p (const char * path , int mode )
25
25
{
26
+ int r ;
27
+
26
28
#ifdef _WIN32
27
- if (0 != _access (path , 0 )) {
28
- if (0 != _mkdir (path )) {
29
- return false;
30
- }
31
- }
29
+ r = _mkdir (path );
32
30
#else
33
- if (0 != access (path , F_OK )) {
34
- if (0 != mkdir (path , mode )) {
35
- return false;
36
- }
37
- }
31
+ r = mkdir (path , mode );
38
32
#endif
39
33
40
- return true ;
34
+ return ( r == 0 || errno == EEXIST ) ;
41
35
}
42
36
43
37
@@ -57,13 +51,9 @@ mongoc_dump_collection (mongoc_client_t *client,
57
51
58
52
path = bson_strdup_printf ("dump/%s/%s.bson" , database , collection );
59
53
#ifdef _WIN32
60
- if (0 == _access (path , 0 )) {
61
- _unlink (path );
62
- }
54
+ _unlink (path );
63
55
#else
64
- if (0 == access (path , F_OK )) {
65
- unlink (path );
66
- }
56
+ unlink (path );
67
57
#endif
68
58
69
59
stream = fopen (path , "w" );
You can’t perform that action at this time.
0 commit comments