VirtualBox

source: vbox/trunk/src/libs/openssl-3.1.4/util/mkdir-p.pl@ 103873

Last change on this file since 103873 was 102863, checked in by vboxsync, 10 months ago

openssl-3.1.4: Applied and adjusted our OpenSSL changes to 3.1.3. bugref:10577

  • Property svn:executable set to *
File size: 1001 bytes
Line 
1#! /usr/bin/env perl
2# Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the Apache License 2.0 (the "License"). You may not use
5# this file except in compliance with the License. You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
8
9# On some systems, the -p option to mkdir (= also create any missing parent
10# directories) is not available.
11
12my $arg;
13
14foreach $arg (@ARGV) {
15 $arg =~ tr|\\|/|;
16 &do_mkdir_p($arg);
17}
18
19
20sub do_mkdir_p {
21 local($dir) = @_;
22
23 $dir =~ s|/*\Z(?!\n)||s;
24
25 if (-d $dir) {
26 return;
27 }
28
29 if ($dir =~ m|[^/]/|s) {
30 local($parent) = $dir;
31 $parent =~ s|[^/]*\Z(?!\n)||s;
32
33 do_mkdir_p($parent);
34 }
35
36 unless (mkdir($dir, 0777)) {
37 local($err) = $!;
38 if (-d $dir) {
39 # We raced against another instance doing the same thing.
40 return;
41 }
42 die "Cannot create directory $dir: $err\n";
43 }
44 print "created directory `$dir'\n";
45}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette