diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2014-11-19 01:07:58 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2014-11-19 01:07:58 +0000 |
commit | 9268022b74279434ed6300244e3f977e56a8ceb5 (patch) | |
tree | 377ac0ac449528621eb192cd245adadb5fd53668 /usr.bin/xinstall | |
parent | 29c34e9d2781cf25403647fb5af7d7ddb23be7e1 (diff) | |
parent | 8c3d6a4ab2a4a95d864d9a32d0157d7de90498a4 (diff) | |
download | src-9268022b74279434ed6300244e3f977e56a8ceb5.tar.gz src-9268022b74279434ed6300244e3f977e56a8ceb5.zip |
Merge from head@274682
Notes
Notes:
svn path=/projects/bmake/; revision=274683
Diffstat (limited to 'usr.bin/xinstall')
-rw-r--r-- | usr.bin/xinstall/xinstall.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index f40cdc5e7870..b59db70bf99d 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -1263,13 +1263,18 @@ install_dir(char *path) if (!*p || (p != path && *p == '/')) { ch = *p; *p = '\0'; - if (stat(path, &sb)) { - if (errno != ENOENT || mkdir(path, 0755) < 0) { +again: + if (stat(path, &sb) < 0) { + if (errno != ENOENT) + err(EX_OSERR, "stat %s", path); + if (mkdir(path, 0755) < 0) { + if (errno == EEXIST) + goto again; err(EX_OSERR, "mkdir %s", path); - /* NOTREACHED */ - } else if (verbose) + } + if (verbose) (void)printf("install: mkdir %s\n", - path); + path); } else if (!S_ISDIR(sb.st_mode)) errx(EX_OSERR, "%s exists but is not a directory", path); if (!(*p = ch)) |