@@ -84,8 +84,6 @@ static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt);
84
84
85
85
static char * prependDirectory (ArchiveHandle * AH , const char * relativeFilename );
86
86
87
- static void createDirectory (const char * dir );
88
-
89
87
90
88
/*
91
89
* Init routine required by ALL formats. This is a global routine
@@ -148,8 +146,9 @@ InitArchiveFmt_Directory(ArchiveHandle *AH)
148
146
149
147
if (AH -> mode == archModeWrite )
150
148
{
151
- /* Create the directory, errors are caught there */
152
- createDirectory (ctx -> directory );
149
+ if (mkdir (ctx -> directory , 0700 ) < 0 )
150
+ exit_horribly (modulename , "could not create directory \"%s\": %s\n" ,
151
+ ctx -> directory , strerror (errno ));
153
152
}
154
153
else
155
154
{ /* Read Mode */
@@ -628,34 +627,6 @@ _EndBlobs(ArchiveHandle *AH, TocEntry *te)
628
627
ctx -> blobsTocFH = NULL ;
629
628
}
630
629
631
- static void
632
- createDirectory (const char * dir )
633
- {
634
- struct stat st ;
635
-
636
- /* the directory must not exist yet. */
637
- if (stat (dir , & st ) == 0 )
638
- {
639
- if (S_ISDIR (st .st_mode ))
640
- exit_horribly (modulename ,
641
- "cannot create directory %s, it exists already\n" ,
642
- dir );
643
- else
644
- exit_horribly (modulename ,
645
- "cannot create directory %s, a file with this name "
646
- "exists already\n" , dir );
647
- }
648
-
649
- /*
650
- * Now we create the directory. Note that for some race condition we could
651
- * also run into the situation that the directory has been created just
652
- * between our two calls.
653
- */
654
- if (mkdir (dir , 0700 ) < 0 )
655
- exit_horribly (modulename , "could not create directory %s: %s\n" ,
656
- dir , strerror (errno ));
657
- }
658
-
659
630
660
631
static char *
661
632
prependDirectory (ArchiveHandle * AH , const char * relativeFilename )
0 commit comments