@@ -84,8 +84,6 @@ static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt);
8484
8585static char * prependDirectory (ArchiveHandle * AH , const char * relativeFilename );
8686
87- static void createDirectory (const char * dir );
88-
8987
9088/*
9189 * Init routine required by ALL formats. This is a global routine
@@ -148,8 +146,9 @@ InitArchiveFmt_Directory(ArchiveHandle *AH)
148146
149147 if (AH -> mode == archModeWrite )
150148 {
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 ));
153152 }
154153 else
155154 { /* Read Mode */
@@ -628,34 +627,6 @@ _EndBlobs(ArchiveHandle *AH, TocEntry *te)
628627 ctx -> blobsTocFH = NULL ;
629628}
630629
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-
659630
660631static char *
661632prependDirectory (ArchiveHandle * AH , const char * relativeFilename )
0 commit comments