libshare: nfs: always try to mkdir()
This also works out to one syscall if the directory exists, but is one syscall shorter if it doesn't. Reviewed-by: Don Brady <don.brady@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12067
This commit is contained in:
parent
1e78b4eee0
commit
82e414f1b2
|
@ -89,11 +89,9 @@ struct tmpfile {
|
||||||
static boolean_t
|
static boolean_t
|
||||||
nfs_init_tmpfile(const char *prefix, const char *mdir, struct tmpfile *tmpf)
|
nfs_init_tmpfile(const char *prefix, const char *mdir, struct tmpfile *tmpf)
|
||||||
{
|
{
|
||||||
struct stat sb;
|
|
||||||
|
|
||||||
if (mdir != NULL &&
|
if (mdir != NULL &&
|
||||||
stat(mdir, &sb) < 0 &&
|
mkdir(mdir, 0755) < 0 &&
|
||||||
mkdir(mdir, 0755) < 0) {
|
errno != EEXIST) {
|
||||||
fprintf(stderr, "failed to create %s: %s\n",
|
fprintf(stderr, "failed to create %s: %s\n",
|
||||||
mdir, strerror(errno));
|
mdir, strerror(errno));
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
|
|
Loading…
Reference in New Issue